(JAVA对进制的运算)A + B Again hdu2057 要复习
2021-06-23 12:04
标签:output php script 去除 upper acea panel div next 链接:http://acm.hdu.edu.cn/showproblem.php?pid=2057 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) (JAVA对进制的运算)A + B Again hdu2057 要复习 标签:output php script 去除 upper acea panel div next 原文地址:https://www.cnblogs.com/Weixu-Liu/p/9674229.html
(置顶,复习)A + B Again
Total Submission(s): 35905 Accepted Submission(s):
14614
Give you two hexadecimal integers , your task is to
calculate the sum of them,and print it in hexadecimal too.
Easy ? AC it
!
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.import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner inScanner = new Scanner(System.in);
while(inScanner.hasNext()) {
long l = Long.parseLong(inScanner.next().replaceAll("\\+", ""),16)
+ Long.parseLong(inScanner.next().replaceAll("\\+", ""),16);
if(l {
System.out.println(Long.toHexString(l).toUpperCase());
}
}
}
}
上一篇:27.C++- 智能指针
下一篇:1、【C++基础】简介
文章标题:(JAVA对进制的运算)A + B Again hdu2057 要复习
文章链接:http://soscw.com/index.php/essay/97778.html