結果

問題 No.3062 A + B
ユーザー kusagame12kusagame12
提出日時 2023-11-06 21:53:02
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 506 bytes
コンパイル時間 2,504 ms
コンパイル使用メモリ 76,460 KB
実行使用メモリ 57,528 KB
最終ジャッジ日時 2023-11-06 21:53:08
合計ジャッジ時間 4,793 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
57,472 KB
testcase_01 AC 123 ms
57,272 KB
testcase_02 AC 110 ms
56,284 KB
testcase_03 AC 121 ms
57,528 KB
testcase_04 AC 119 ms
57,376 KB
testcase_05 AC 109 ms
56,276 KB
testcase_06 RE -
testcase_07 AC 148 ms
57,520 KB
testcase_08 AC 121 ms
57,520 KB
testcase_09 AC 127 ms
57,208 KB
testcase_10 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String b = sc.next();
        
        String ans = "";
        if(a.equals("0")){
            ans = b;
        }else if(b.charAt(0) == '-'){
            ans = String.valueOf(Integer.parseInt(a) + Integer.parseInt(b));
        }else{
            ans = a + b;
        }
        
        System.out.println(ans);
    }
}
0