結果

問題 No.446 ゆきこーだーの雨と雪 (1)
ユーザー yagi2yagi2
提出日時 2017-04-15 19:06:08
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 795 bytes
コンパイル時間 2,120 ms
コンパイル使用メモリ 71,420 KB
実行使用メモリ 55,960 KB
最終ジャッジ日時 2023-09-25 22:20:56
合計ジャッジ時間 5,249 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
55,804 KB
testcase_01 AC 120 ms
55,768 KB
testcase_02 AC 115 ms
55,692 KB
testcase_03 AC 114 ms
55,620 KB
testcase_04 AC 115 ms
55,848 KB
testcase_05 AC 115 ms
55,704 KB
testcase_06 WA -
testcase_07 AC 117 ms
55,864 KB
testcase_08 WA -
testcase_09 AC 118 ms
55,924 KB
testcase_10 AC 115 ms
55,664 KB
testcase_11 AC 118 ms
55,736 KB
testcase_12 AC 116 ms
55,312 KB
testcase_13 AC 116 ms
55,804 KB
testcase_14 AC 116 ms
55,960 KB
testcase_15 AC 115 ms
55,600 KB
testcase_16 AC 115 ms
55,688 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String A = sc.next();
        String B = sc.next();

        if (checkFormat(A) && checkFormat(B)) {
            System.out.println("OK");
        } else {
            System.out.println("NG");
        }

    }
    private static boolean checkFormat(String str) {
        boolean result = true;

        for (int i = 0; i < str.length(); i++) {
            if (!Character.isDigit(str.charAt(i))) {
                result = false;
                break;
            }

            if (i == 0 && str.charAt(i) == '0' && str.length() > 1) {
                result = false;
                break;
            }
        }

        return result;
    }
}
0