結果

問題 No.446 ゆきこーだーの雨と雪 (1)
ユーザー TwinkleStar74TwinkleStar74
提出日時 2017-10-28 20:58:46
言語 Java21
(openjdk 21)
結果
AC  
実行時間 53 ms / 2,000 ms
コード長 919 bytes
コンパイル時間 2,929 ms
コンパイル使用メモリ 74,808 KB
実行使用メモリ 37,000 KB
最終ジャッジ日時 2024-05-01 21:32:32
合計ジャッジ時間 4,467 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 50 ms
36,912 KB
testcase_01 AC 50 ms
36,972 KB
testcase_02 AC 53 ms
36,924 KB
testcase_03 AC 53 ms
36,972 KB
testcase_04 AC 51 ms
36,916 KB
testcase_05 AC 50 ms
36,772 KB
testcase_06 AC 49 ms
36,852 KB
testcase_07 AC 50 ms
36,872 KB
testcase_08 AC 51 ms
36,720 KB
testcase_09 AC 52 ms
36,944 KB
testcase_10 AC 52 ms
36,672 KB
testcase_11 AC 51 ms
36,860 KB
testcase_12 AC 51 ms
37,000 KB
testcase_13 AC 51 ms
36,896 KB
testcase_14 AC 51 ms
36,972 KB
testcase_15 AC 50 ms
36,940 KB
testcase_16 AC 51 ms
36,892 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;

public class No446{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String a = br.readLine();
        String b = br.readLine();
        char[] A = a.toCharArray();
        char[] B = b.toCharArray();
        if(check(a, A) && check(b, B))  System.out.println("OK");
        else  System.out.println("NG");
    }
        
    public static boolean check(String a, char[] A){
        boolean c = false;
        int count = 0;
        for(int i=0; i < A.length; i++)
            if(Character.isDigit(A[i]))  count++;
        if(count == A.length){
           int num = Integer.parseInt(a);
           if(num != 0 && a.startsWith("0"))  return c;
           else if(num == 0 && a.startsWith("00")) return c;
           else if(0 <= num && num <= 12345 ) c = true;
        }
        return c;
    }
}
0