题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1720
题目大意:输入两个十六进制数字,输出十进制和。
思路:C语言scanf()函数,%x 直接控制输入十六进制,%d 控制输出十进制。
代码:
#include<stdio.h> int main() { int a, b; while (~scanf("%x %x", &a, &b)) { printf("%d\n", a + b); } }
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1720
题目大意:输入两个十六进制数字,输出十进制和。
思路:C语言scanf()函数,%x 直接控制输入十六进制,%d 控制输出十进制。
代码:
#include<stdio.h> int main() { int a, b; while (~scanf("%x %x", &a, &b)) { printf("%d\n", a + b); } }