杭电oj(Java版)——1720 A+B Coming
来源:互联网 发布:mac怎么保存文档 编辑:程序博客网 时间:2024/05/29 07:13
A+B Coming
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 9152 Accepted Submission(s): 5979
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 9A Ba b
Sample Output
102121import java.util.Scanner;public class Main{public static void main(String[] args) {Scanner scanner = new Scanner(System.in);while (scanner.hasNext()) {String str = scanner.nextLine();str = str.toLowerCase();str = str.replace(" ", "");char arr[] = str.toCharArray();int a = 0;int b = 0;switch (arr[0]) {case '0':a = 0;break;case '1':a =1;break;case '2':a = 2;break;case '3':a = 3;break;case '4':a = 4;break;case '5':a = 5;break;case '6':a = 6;break;case '7':a = 7;break;case '8':a = 8;break;case '9':a = 9;break;case 'a':a = 10;break;case 'b':a = 11;break;case 'c':a = 12;break;case 'd':a = 13;break;case 'e':a = 14;break;case 'f':a = 15;break;}switch (arr[1]) {case '0':b = 0;break;case '1':b =1;break;case '2':b = 2;break;case '3':b = 3;break;case '4':b = 4;break;case '5':b = 5;break;case '6':b = 6;break;case '7':b = 7;break;case '8':b = 8;break;case '9':b = 9;break;case 'a':b = 10;break;case 'b':b = 11;break;case 'c':b = 12;break;case 'd':b = 13;break;case 'e':b = 14;break;case 'f':b = 15;break;}System.out.println(a+b);}}}
0 0
- 杭电oj(Java版)——1720 A+B Coming
- 杭电 OJ 1720 A+B Coming
- 杭电OJ-A+B Coming
- 杭电OJ题1720 A+B Coming 解题报告
- 杭电ACM 1720: A+B Coming
- 杭电oj(java版)——1090 A+B for Input-Output Practice (II)
- 杭电oj(java版)——1092 A+B for Input-Output Practice (IV)
- 杭电oj(java版)——1093 A+B for Input-Output Practice (V)
- 杭电oj(java版)——1096 A+B for Input-Output Practice (VIII)
- 杭电oj(Java版)—— 1002 A + B Problem II
- 杭电 HDU ACM 1720 A+B Coming
- 杭电 1720 A+B Coming 十六进制转化为十进制
- 杭电oj(Java版)——1091 A+B for Input-Output Practice (III)
- A+B Coming 1720
- 1720 A+B Coming
- 杭电OJ——1228 A+B
- 杭电OJ——1229 还是A+B
- 杭电OJ——1230 火星A+B
- offsetHeight、offsetWidth、clientWidth、clientHeight无法获取值得问题
- 有些时候,有些判断是无法做到真实,但是能做到最优也不错了
- 来谈谈SQL数据库中"简单的"SELECT TOP—可能有你从未注意到的细节
- JAVA动态代理的理解(转载)
- poj 2485 prim入门题目
- 杭电oj(Java版)——1720 A+B Coming
- CSS样式的优先级
- 粉丝经济新时代来临,商虫云微信群控系统的商机你看到...
- tp ajax 搜索分页
- XZ_iOS之app分享到QQ或者微信,然后点击分享链接调起app
- 杭电oj(Java版)——1722 Cake
- 如何生成id_dsa.pub?
- PAT_1031. Hello World for U
- 最长上升子序列的和