hdu 2057 a + b again

来源:互联网 发布:bpm开源软件 编辑:程序博客网 时间:2024/05/17 01:50

http://acm.hdu.edu.cn/showproblem.php?pid=2057

#include <iostream>#include <cstdio>using namespace std;//在十进制的时候,电脑也是转化为二进制的,所以我们只需要进行16禁止的输入输出就行了//但是在这里要注意输出格式int main(){    __int64 a,b;//也可以用long long    while(scanf("%I64x%I64x",&a,&b)!=-1)//直接用16进制的加法和减法    {        if(a+b<0)            printf("-%I64X\n",-a-b);//注意不是 a + b        else            printf("%I64X\n",a+b);    }    return 0;}
0 0
原创粉丝点击