摘要:
#include<stdio.h>int main(){ int m,n,i,line[104],s,j,h; int aver1,aver2; while(scanf("%d%d",&n,&m)!=EOF) { line[0]=2; for(i=1;i<n;i++) line[i]=line[i-1]+2; h=n%m; for(j=0;j<n/m;j++) { s=0; for(i=j*m;i<(j+1)*m;i++) s=line[i]+s; aver1=s/m; if(j==0) printf("%d" 阅读全文
摘要:
#include<stdio.h>#include<stdlib.h>int cmp(const void*p1,const void*p2){ return *(int*)p1-*(int*)p2;}int main(){ int n,score[105],i; double s,aver; while(scanf("%d",&n)!=EOF) { s=0; for(i=0;i<n;i++) scanf("%d",&score[i]); qsort(score,n,sizeof(score[0]),cmp) 阅读全文