結果

問題 No.446 ゆきこーだーの雨と雪 (1)
ユーザー yagi2
提出日時 2017-04-15 19:06:08
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 795 bytes
コンパイル時間 2,678 ms
コンパイル使用メモリ 74,576 KB
実行使用メモリ 41,600 KB
最終ジャッジ日時 2024-07-18 18:00:45
合計ジャッジ時間 5,634 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 11 WA * 2
権限があれば一括ダウンロードができます

ソースコード

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