国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Java > 正文

HDU 2057 JAVA

2019-11-06 07:21:05
字體:
來源:轉載
供稿:網友

PRoblem Description There must be many A + B problems in our HDOJ , now a new one is coming. Give you two hexadecimal integers , your task is to calculate the sum of them,and print it in hexadecimal too. Easy ? AC it !

Input The input contains several test cases, please process to the end of the file. Each case consists of two hexadecimal integers A and B in a line seperated by a blank. The length of A and B is less than 15.

Output For each test case,print the sum of A and B in hexadecimal in one line.

Sample Input +A -A +1A 12 1A -9 -1A -12 1A -AA

Sample Output 0 2C 11 -2C -90

import java.util.*;class Main{ public static void main(String _[]) { Scanner sc=new Scanner(System.in); while(sc.hasNext()){ String a=sc.next(); String b=sc.next(); long i=Long.parseLong(a.replaceAll("http://+",""),16)+Long.parseLong(b.replaceAll("http://+",""),16); if(i<0)System.out.println("-"+Long.toHexString(-i).toUpperCase()); else System.out.println(Long.toHexString(i).toUpperCase()); } }}
上一篇:HDU 2058 JAVA

下一篇:HDU 2056 JAVA

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 西乌| 泊头市| 玉田县| 广饶县| 临武县| 桂平市| 稷山县| 五河县| 都匀市| 临沂市| 枣强县| 沁水县| 平阳县| 高碑店市| 阿勒泰市| 玉溪市| 成武县| 竹溪县| 武陟县| 泗水县| 平泉县| 韶山市| 女性| 墨江| 得荣县| 车致| 永善县| 盐源县| 大关县| 荆州市| 泽州县| 昭平县| 白城市| 元氏县| 古交市| 胶州市| 龙南县| 衡山县| 灌南县| 辽源市| 宝山区|