zoukankan      html  css  js  c++  java
  • HDOJ(HDU) 1720 A+B Coming(进制)

    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. ^_^

    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.

    Output
    Output A+B in decimal number in one line.

    Sample Input
    1 9
    A B
    a b

    Sample Output
    10
    21
    21

    超简单的题目,,,就是给2个16进制的数,将它们的和按10进制输出!
    JAVA可以直接读取16进制的数!

    import java.util.Scanner;
    
    public class Main {
        public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            while(sc.hasNext()){
                int a = sc.nextInt(16);
                int b = sc.nextInt(16);
                System.out.println(a+b);
            }
    
        }
    
    }
    
  • 相关阅读:
    查看数据库表中的数据
    exec和execsql
    CPI
    百度硬盘可以检索的字节测试
    HDU2095
    Vigenere密码
    斌神无所不能
    HDU p1017
    POJ1316
    head区的代码详解
  • 原文地址:https://www.cnblogs.com/webmen/p/5739277.html
Copyright © 2011-2022 走看看