| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
求测试数据:#include<stdio.h>
int main(){
int n,m,num,j = 0,average;
float cost[1000],exchange[1000];
while(scanf("%d", &num) && num ){
n = num;
m = n;
float sum = 0.00;
exchange[j] = 0.00;
while(n--){
scanf("%f", &cost[n]);
sum = sum + cost[n];
}
average = sum*100 / m +0.5; //四舍五入平均值
//printf("$%f", average/100);
int i;
for(i = 0; i< m; ++i){
if(cost[i] > average/100.0){
exchange[j] = exchange[j] + cost[i] - average/100.0;
//printf("$%.2f\n", exchange[0]);
}
}
j++;
}
//输出
int k = 0;
while(j--){
printf("$%.2f\n", exchange[k++]);
}
system("pause");
return 0;
}
哪错了,结果都对啊,怎么WA啊,有木有!有木有!,现求测试数据。
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator