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

问下,C++能过,但是GCC就WA,不知道两者对代码要求有什么不同!!?

Posted by ook at 2006-04-21 21:47:37
#include "stdio.h"
#include "string.h"
#include "math.h"
char a[10];
int main()
{
int i,j;
long sum,sum1;
while(1)
{
scanf("%s",a);
if(a[0]=='0') break;
sum=sum1=0;
j=strlen(a);
for(i=0;i<j;i++)
{
if(a[i]-'0'>4)
sum+=(a[i]-'1')*pow(9,j-i-1);
else
sum+=(a[i]-'0')*pow(9,j-i-1);

            sum1+=(a[i]-'0')*pow(10,j-i-1);
}

printf("%ld: %ld\n",sum1,sum);
}
return 1;
}


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