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

为什么测试了各种数据都是对的,但是提交的时候却还是Wrong呢???求大神帮助呀

Posted by zhjacm at 2013-04-09 23:22:04 on Problem 1503
#include<iostream>
using namespace std;
int main()
{
	char temp[100];
int sum[100]={0},i,s,j,k=0,t=0;
while(cin>>temp,temp[0]!='0')
	{	
	int m[100]={0};
	for(i=0;temp[i]!='\0';i++);
	    if(i>k)
		k=i;
	 for(j=100-i,s=0;j<100;s++,j++)
			m[j]=temp[s]-48;
		for(j=99;j>99-k;j--)
		{
			sum[j]+=m[j];
			if(j==100-k)
			break;
			if(sum[j]>=10)
			{
				sum[j]-=10;
				sum[j-1]+=1;
			}
		}
		for(i=0;i<100;i++)
			temp[i]='\0';t++;
	}

	for(i=100-k;i<100;i++)
		cout<<sum[i];
	cout<<endl;
	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