結果

問題 No.3062 A + B
ユーザー kusagame12kusagame12
提出日時 2023-11-06 21:55:38
言語 Java21
(openjdk 21)
結果
AC  
実行時間 129 ms / 2,000 ms
コード長 547 bytes
コンパイル時間 2,471 ms
コンパイル使用メモリ 85,648 KB
実行使用メモリ 57,580 KB
最終ジャッジ日時 2023-11-06 21:55:43
合計ジャッジ時間 4,497 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
57,580 KB
testcase_01 AC 129 ms
57,516 KB
testcase_02 AC 128 ms
57,524 KB
testcase_03 AC 126 ms
57,508 KB
testcase_04 AC 126 ms
57,504 KB
testcase_05 AC 128 ms
57,528 KB
testcase_06 AC 124 ms
57,488 KB
testcase_07 AC 126 ms
56,280 KB
testcase_08 AC 124 ms
55,560 KB
testcase_09 AC 127 ms
57,508 KB
testcase_10 AC 127 ms
57,148 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String b = sc.next();
        
        String ans = "";
        if(a.equals("0") || a.equals("-0") ){
            ans = b;
        }else if(b.charAt(0) == '-'){
            ans = String.valueOf(Long.parseLong(a) + Long.parseLong(b));
        }else{
            ans = a + b;
        }
        
        System.out.println(ans);
    }
}
0