ACMSTEP 1.2.2 A+B Coming //超级水题 控制格式输入输出(CC++)
来源:互联网 发布:快速模板匹配算法 编辑:程序博客网 时间:2024/05/16 06:57
A+B Coming
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 880 Accepted Submission(s): 443Problem 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
没什么难度主要是scanf和printf的输入输出格式。
C++中也有,主要用控制流输入输出来实现,具体如下(需要头文件iomanip)
dec 置基数为10 hex 置基数为16 oct 置基数为8 setfill(c) 设填充字符为c setprecision(n) 设显示小数精度为n位 setw(n) 设域宽为n个字符 setiosflags(ios::fixed) 固定的浮点显示 setiosflags(ios::scientific) 指数表示 setiosflags(ios::left) 左对齐 setiosflags(ios::right) 右对齐 setiosflags(ios::skipws) 忽略前导空白 setiosflags(ios::uppercase)16进制数大写输出 setiosflags(ios::lowercase)16进制数小写输出
#include <cstdio>#include <cstdlib>using namespace std;int main(){int a, b;while (scanf("%x %x",&a, &b)!=EOF){printf("%d\n",a+b);}return 0;}
- ACMSTEP 1.2.2 A+B Coming //超级水题 控制格式输入输出(CC++)
- ACMSTEP 1.2.6 ASCII//超级水题
- 1.2.2 a+b coming
- hdu 1720(ACM steps 1.2.2)A+B coming
- ACMSTEP 1.2.5 IBM Minus One//超级水题
- ACMSTEP 1.2.3 QuickSum //超级水题 模拟
- A+B coming 多进制输入输出问题。hdu 1720
- hdu 1.2.1A+B Coming
- HDU_ACM step 1.2.1 A+B Coming
- HDU 1720 A+B Coming【水】
- hdoj 1720 A+B Coming (超水题!!)
- 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
- 变量和基本类型
- FLASH内存优化13条
- 红薯 使用Microsoft Web Application Stress Tool对web进行压力测试
- 二、数据类型、运算符和表达式
- 系统Hang住时用oradebug分析的方法
- ACMSTEP 1.2.2 A+B Coming //超级水题 控制格式输入输出(CC++)
- GitHub简介
- 批量删除
- ORADEBUG 学习笔记
- jQuery最佳实践
- 手机基站伪装潜伏引强烈关注
- 创业故事:挖人的手段
- 创意手机APP汇总
- 关于Android堆内存的设置