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

咋是wronganswer呀!帮忙看看吧!谢谢!

Posted by 05031017 at 2010-05-03 21:44:17 on Problem 1064
#include "stdio.h"
#include "string.h"

int main()
{   long c[10001]={'\0'};
    char s[10]={'\0'};
    int m;
    long a, average, b, i, k, j;
    long long sum=0, x[9]={1,10,100,1000,10000,100000,1000000,10000000,100000000};
    scanf("%ld %ld",&a,&b);
    for ( i=0; i<a; i++)
    {
        scanf("%s",s);
        m=strlen(s);
        for( j=0,k=m-2; j<m; j++)
           if(s[j]!='.') c[i] += (s[j]-'0')*x[k--];
        sum += c[i];
    }
    average = sum/b;
    for ( i=average; i>0; i--)
    {   k=0;
        for ( j=0; j<a; j++)
        {
            k += c[j]/i;
        }
        if( k>=b ) break;
    }
    printf("%.2f\n",i/100.0);
    return 0;
}

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