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 LXY5201314 at 2018-01-18 22:56:16 on Problem 2602
#include<stdio.h>
char a[1000001],b[1000001],sum[1000001];
main()
{
    int n,i,count,k;
    scanf("%d",&n);getchar();
    for(i=1;i<=n;i++)
        {
            a[i]=getchar();getchar();
            b[i]=getchar();getchar();
        }
    count=0;
    for(i=n;i>=1;i--)
    {
        k=(a[i]-'0')+(b[i]-'0')+count;
        count=k/10;
        if(k>=10)
        {
            k%=10;
        }
        sum[i]=k+'0';
    }
    sum[n+1]='\0';
    if(count)printf("%d",count);
    printf("%s\n",sum+1);
    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