結果

問題 No.446 ゆきこーだーの雨と雪 (1)
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2016-11-18 22:49:17
言語 Java21
(openjdk 21)
結果
AC  
実行時間 111 ms / 2,000 ms
コード長 763 bytes
コンパイル時間 2,126 ms
コンパイル使用メモリ 71,908 KB
実行使用メモリ 56,272 KB
最終ジャッジ日時 2023-08-17 11:18:07
合計ジャッジ時間 4,847 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 109 ms
56,132 KB
testcase_01 AC 109 ms
55,804 KB
testcase_02 AC 111 ms
56,272 KB
testcase_03 AC 110 ms
56,016 KB
testcase_04 AC 110 ms
56,060 KB
testcase_05 AC 110 ms
55,960 KB
testcase_06 AC 110 ms
55,768 KB
testcase_07 AC 110 ms
55,836 KB
testcase_08 AC 110 ms
56,024 KB
testcase_09 AC 109 ms
55,540 KB
testcase_10 AC 110 ms
56,216 KB
testcase_11 AC 110 ms
55,952 KB
testcase_12 AC 110 ms
56,272 KB
testcase_13 AC 109 ms
55,824 KB
testcase_14 AC 110 ms
56,256 KB
testcase_15 AC 110 ms
56,132 KB
testcase_16 AC 109 ms
56,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String A = sc.next();
        String B = sc.next();
        int a = checker(A);
        int b = checker(B);
        if(a==0 && b==0){
            System.out.println("OK");
        }else{
            System.out.println("NG");
        }
    }
    static int checker(String S){
        try{
            int z = Integer.parseInt(S);
            if(z>12345 || z<0){
                return 1;
            }
            String t = String.valueOf(z);
            if( !(t.equals(S)) ){
                return 2;
            }
            return 0;
        } catch ( NumberFormatException e ) {
            return 3;
        }
    }
}
0