现在的位置: 首页 > 综合 > 正文

hdu4554 西山居 叛逆的小明

2013年08月26日 ⁄ 综合 ⁄ 共 339字 ⁄ 字号 评论关闭

题目  http://acm.hdu.edu.cn/showproblem.php?pid=4554

这个题目只要小心一点就可以了哦

具体ac代码

 

#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int main()
{
    int t,m,n;
    __int64 a,b,x,y,s,s1;
    while(cin>>t)
    {
        while(t--)
        {
            s=0,s1=0;
            cin>>x>>y;

            a=(x+y)/2;
            b=x-a;

            while(a)
            {
                m=a%10;
                a=a/10;
                s=10*s+m;
            }
            while(b)
            {
                n=b%10;
                b=b/10;
                s1=10*s1+n;
            }

            cout<<s+s1<<" "<<s-s1<<endl;
        }
    }
}

 

 

抱歉!评论已关闭.