A+B Coming
来源:互联网 发布:程序员才能看懂的密码 编辑:程序博客网 时间:2024/05/16 11:24
Description
Many classmates said to me that A+B is must needs.
If you can’t AC this problem, you would invite me for night meal. ^_^
If you can’t AC this problem, you would invite me for night meal. ^_^
Input
Input may contain multiple test cases. Each case contains A and B in one line.
A, B are hexadecimal number.
Input terminates by EOF.
A, B are hexadecimal number.
Input terminates by EOF.
Output
Output A+B in decimal number in one line.
Sample Input
1 9A Ba b
Sample Output
102121
主要是strtol函数的运用,它可以将字符串里面的数字传换成10进制。
#include<stdio.h>#include <stdlib.h>int main(){char a[16],b[16];long long x,y,sum;while(scanf("%s%s",&a,&b)!=EOF){ x=strtol( a,NULL,16); y=strtol( b, NULL,16); sum=x+y; if(sum<0){ sum=-sum; printf("-%d\n",sum);} else printf("%d\n",sum); }}
。
阅读全文
0 0
- A+B Coming 1720
- A+B Coming
- HDU1720 A+B Coming
- 1720 A+B Coming
- HDOJ1720 A+B Coming
- HDU1720 A+B Coming
- A+B Coming
- A+B Coming 解题报告
- HDU 1720 A+B Coming
- hdu 1720 A+B Coming
- hdu 1720 A+B Coming
- HDU 1720 A+B Coming
- hd 1720 A+B Coming
- HDU 1720 A+B Coming
- HDU 1720 A+B Coming
- hdu 1720 A+B coming
- hdoj-1720-A+B Coming
- 1.2.2 a+b coming
- hdu 2594 kmp Simpsons’ Hidden Talents
- RocketMQ——Consumer篇:PUSH模式下消费消息(顺序和并发两种)
- 字符编码简介
- 枪林弹雨中成长
- cocos js listview 开启截图后截屏变色的问题
- A+B Coming
- JVM内存初探
- MySQL学习笔记——20170810
- Linux下数据库sqlite3
- 贾扬清撰文详解Caffe2:从强大的新能力到入门上手教程
- 刚装Ubuntu16.10我遇到的问题及解决
- 8.11 B
- Hibernate的二级缓存
- HDU3483 A Very Simple Problem (矩阵快速幂)