标签:des style blog color io java strong for 数据
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 46061 Accepted Submission(s):
20130
1 #include<cstdio> 2 int main() 3 { 4 int n,m; 5 while(scanf("%d%d",&n,&m)==2) 6 { 7 if(n<1||n>100)return 0;//4 2 8 int x=0,sum=0; 9 for(int i=1;i<=n;i++) 10 { 11 sum=sum+i*2; 12 ++x; 13 if(x==m) 14 { 15 if(i==n)printf("%d\n",sum/x); 16 else printf("%d ",sum/x); 17 sum=x=0; 18 } 19 } 20 if(x!=m&&x)printf("%d\n",sum/x);//当i==n时,x=0,做个小处理。 21 } 22 return 0; 23 }
标签:des style blog color io java strong for 数据
原文地址:http://www.cnblogs.com/The-courage-that-year/p/3993533.html