| ||||||||||
| 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 | |||||||||
求牛人解救!!1503!!!万分感谢啊!!!#include<iostream>
#include<math.h>
#include<string.h>
using namespace std;
int shu=0;
void f(int a[],int b[],int n)
{
int i;
for(i=0;i<n;i++)
{
a[i]=b[i]+a[i];
a[i+1]=a[i]/10+a[i+1];
a[i]=a[i]%10;
}
if(a[i+1]!=0)
shu=i+1;
else shu=i;
}
int main()
{
char m[100],s[100]="0";
int x[100],y[100];
int i=0,j,t,lena,lenb;
memset(x,0,sizeof(x));
memset(y,0,sizeof(y));
while(1)
{
cin>>m;
if(strcmp(m,s)==0) break;
if(i<1)
{
lena=strlen(m);
t=lena;
for(j=0;j<lena;j++)
x[strlen(m)-1-j]=m[j]-'0';
}
else
{
lenb=strlen(m);
for(j=0;j<lenb;j++)
y[strlen(m)-1-j]=m[j]-'0';
}
if(i>=1)
{
if(lenb>=t) t=lenb;
f(x,y,t);
memset(y,0,sizeof(y));
}
i++;
}
if(x[shu]==0) shu--;
for(i=shu;i>=0;i--)
cout<<x[i];
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