nyoj 1242 Interference Signal (河南省第八届acm程序设计大赛)

网友投稿 287 2022-09-06

nyoj 1242 Interference Signal (河南省第八届acm程序设计大赛)

题目1242​​题目信息​​​​运行结果​​​​本题排行​​​​讨论区​​

Interference Signal

2000 ms  |  内存限制: 65535

难度:1

Dr.Kong’s laboratory monitor some interference signals. The interference signals can be digitized into a series of positive integer. May be, there are N integers

Dr.Kong wants to know the average strength of a contiguous interference signal block. the block must contain at least M integers.

Please help Dr.Kong to calculate the maximum average strength, given the constraint.

The input contains K test cases. Each test case specifies:

* Line 1: Two space-separated integers, N and M.

* Lines2~line N+1: ai (i=1,2,…,N)

1 ≤ K≤ 8, 5 ≤ N≤ 2000, 1 ≤ M ≤ N, 0 ≤ ai ≤9999

输出 For each test case generate a single line containing a single integer that is 1000 times the maximal average value. Do not perform rounding. 样例输入

2 10 66 42103859415 210385 9

样例输出

65007333

两个注意点 一个是at least 一个是 Do not perform rounding.

#include #include int main(){ int ncase,a[2005]; scanf("%d",&ncase); while(ncase--) { int n,m; double sum,max=-0x3fffffff; memset(a,0,sizeof(a)); scanf("%d %d",&n,&m); for(int i=0;imax) max=sum/k; } } printf("%d\n",(int)(max*1000)); } return 0;}

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:nyoj35 表达式求值(栈)
下一篇:hdu 1039 Easier Done Than Said?
相关文章

 发表评论

暂时没有评论,来抢沙发吧~