Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

求测试数据:

Posted by goingeast at 2011-05-13 00:53:32 on Problem 2646
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator