求助!!

P1001 A+B Problem

wjy2006 @ 2019-09-08 13:44:17

#include<bits/stdc++.h>
using namespace std;

int main()
{
    unsigned a,b;
    cin>>a>>b;
    cout<<a+b<<endl;
    return 0;
}

为什么unsigned类型能过??

链接


by MC_blueberry @ 2019-09-08 17:30:17

服服帖帖


by MC_blueberry @ 2019-09-08 17:30:36

真的水题


by crjcrj3 @ 2019-09-13 21:49:19

include<bits/stdc++.h>

using namespace std;

int x,y;

int i,j;

char ab[100001],bc[100001];

int a[100001],b[100001];

int jw;

int maxn,maxj;

int main( )

{

cin>>ab>>bc;

x=strlen(ab);

y=strlen(bc);
for(i=0;i<x;i++)
    a[i]=ab[x-i-1]-'0';
for(i=0;i<y;i++)
    b[i]=bc[y-i-1]-'0';
maxn=max(x,y);
for(i=0;i<maxn;i++)
{
    a[i]=a[i]+b[i]+jw;
    jw=a[i]/10;
    a[i]%=10;
}
if(jw==1) cout<<jw;
for(i=maxn-1;i>=0;i--)
{
    cout<<a[i];
}
return 0;

}


by 学渣一个 @ 2019-09-22 21:29:15

include<cstdio>

using namespace std;

int a,b;

int main()

{

scanf("%d%d",&a,&b);

printf("%d",(a+b));

return 0; }


by wjy2006 @ 2019-10-15 18:09:53

楼上大毒瘤


上一页 |