本文主要是介绍HDU1720(输入输出涨姿势),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
A+B Coming
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5953 Accepted Submission(s): 3901
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1720
Problem 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 9 A B a b
Sample Output
10 21 21
解题思路:
输入输出的姿势,头一次看到cin、cout可以这样用,新技能get。
11在十进制中等于10 + 1 ,1F在十六进制中等于16 + F = 31。
11在十进制中等于10 + 1 ,1F在十六进制中等于16 + F = 31。
完整代码:
#include <functional>
#include <algorithm>
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <cstring>
#include <climits>
#include <cassert>
#include <complex>
#include <cstdio>
#include <string>
#include <vector>
#include <bitset>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <list>
#include <set>
#include <map>
using namespace std;#pragma comment(linker, "/STACK:102400000,102400000")typedef long long LL;
typedef double DB;
typedef unsigned uint;
typedef unsigned long long uLL;/** Constant List .. **/ //{const int MOD = int(1e9)+7;
const int INF = 0x3f3f3f3f;
const LL INFF = 0x3f3f3f3f3f3f3f3fLL;
const DB EPS = 1e-9;
const DB OO = 1e20;
const DB PI = acos(-1.0); //M_PI;int main()
{#ifdef DoubleQfreopen("in.txt","r",stdin);#endif__int64 a , b;while(cin >> hex >> a >> b){cout << dec << a + b << endl;}
}
这篇关于HDU1720(输入输出涨姿势)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!