标签:col mis des count else BMI ssi ted acm
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 120940 Accepted Submission(s): 50025
这道题感觉不能好好理解题目T T
会卡的地方就在 每m个数求平均值,这里是有m个数,之前求的数不算进来
1 #include<stdio.h> 2 int main() 3 { 4 int n,m; 5 while(~ scanf("%d %d",&n,&m)) { 6 int num[100],sum=0,count=0; 7 for(int i=1; i<=n; i++) { 8 num[i]=i*2; 9 sum+=num[i]; 10 count++; 11 if(count==m) { 12 if(i==n) 13 printf("%d",sum/m); 14 else 15 printf("%d ",sum/m); 16 17 count=0; 18 sum=0; 19 } 20 else if(i==n) { 21 printf("%d",sum/count); 22 } 23 } 24 printf("\n"); 25 } 26 return 0; 27 }
标签:col mis des count else BMI ssi ted acm
原文地址:https://www.cnblogs.com/lightice/p/10261171.html