結果

問題 No.446 ゆきこーだーの雨と雪 (1)
ユーザー tsunabittsunabit
提出日時 2019-06-09 18:08:09
言語 Java21
(openjdk 21)
結果
AC  
実行時間 138 ms / 2,000 ms
コード長 959 bytes
コンパイル時間 3,874 ms
コンパイル使用メモリ 75,352 KB
実行使用メモリ 41,656 KB
最終ジャッジ日時 2024-04-15 20:09:37
合計ジャッジ時間 6,991 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
41,656 KB
testcase_01 AC 135 ms
41,348 KB
testcase_02 AC 133 ms
41,308 KB
testcase_03 AC 133 ms
41,500 KB
testcase_04 AC 132 ms
41,484 KB
testcase_05 AC 133 ms
41,452 KB
testcase_06 AC 138 ms
41,576 KB
testcase_07 AC 135 ms
41,620 KB
testcase_08 AC 133 ms
41,492 KB
testcase_09 AC 132 ms
41,484 KB
testcase_10 AC 135 ms
41,484 KB
testcase_11 AC 136 ms
41,488 KB
testcase_12 AC 135 ms
41,260 KB
testcase_13 AC 132 ms
41,344 KB
testcase_14 AC 133 ms
41,256 KB
testcase_15 AC 134 ms
41,572 KB
testcase_16 AC 135 ms
41,588 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.math.*;

public class No446 {
    public static void main(String[] args) {
        // 標準入力から読み込む際に、Scannerオブジェクトを使う。
        Scanner sc = new Scanner(System.in);
        String a = sc.next(), b = sc.next();
        String atemp = a.replaceAll("\\D", "");
        String btemp = b.replaceAll("\\D", "");
        
        if(a.length() == atemp.length() && b.length() == btemp.length()) {
        	if((a.length() > 1 && a.charAt(0) == '0') || (b.length() > 1 && b.charAt(0) == '0')) {
        		System.out.println("NG");
        	}else {
        		int ai = Integer.parseInt(atemp);
                int bi = Integer.parseInt(btemp);
            	if(ai <= 12345 && bi <= 12345) {
            		System.out.println("OK");
                }else {
                	System.out.println("NG");
                }
        	}
        }else {
        	System.out.println("NG");
        }
    }
}
0