
这是一道简单的输入输出问题,把输入当做十六进制,计算和并按照十进制输出即可。
以下是C和C++两种做法:
1 2 3 4 5 6 7 8 9 10 11
|
#include<iostream> using namespace std; int () { int a,b; while(scanf("%x%x",&a,&b)!=EOF) { printf("%dn",a+b); } return 0; }
|
1 2 3 4 5 6 7 8 9 10 11 12
|
#include<iostream> #include<string> using namespace std; int () { int a,b; while(cin>>hex>>a>>b) { cout<<a+b<<endl; } return 0; }
|
近期评论