結果

問題 No.446 ゆきこーだーの雨と雪 (1)
ユーザー ぴろずぴろず
提出日時 2016-11-18 22:26:29
言語 Java21
(openjdk 21)
結果
AC  
実行時間 122 ms / 2,000 ms
コード長 595 bytes
コンパイル時間 4,162 ms
コンパイル使用メモリ 71,368 KB
実行使用メモリ 56,020 KB
最終ジャッジ日時 2023-08-17 10:38:18
合計ジャッジ時間 6,322 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
55,656 KB
testcase_01 AC 119 ms
55,568 KB
testcase_02 AC 120 ms
55,824 KB
testcase_03 AC 121 ms
55,400 KB
testcase_04 AC 119 ms
55,684 KB
testcase_05 AC 122 ms
55,584 KB
testcase_06 AC 120 ms
56,020 KB
testcase_07 AC 120 ms
55,884 KB
testcase_08 AC 120 ms
55,376 KB
testcase_09 AC 122 ms
55,604 KB
testcase_10 AC 120 ms
55,736 KB
testcase_11 AC 122 ms
55,700 KB
testcase_12 AC 120 ms
55,680 KB
testcase_13 AC 121 ms
55,600 KB
testcase_14 AC 120 ms
55,560 KB
testcase_15 AC 121 ms
55,568 KB
testcase_16 AC 122 ms
55,532 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package no446;

import java.util.Scanner;
import java.util.regex.Pattern;

public class Main {

	public static Pattern regex = Pattern.compile("(0|[1-9][0-9]*)");
	public static int MAX = 12345;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = parse(sc.next());
		int b = parse(sc.next());
		if (0 <= a && a <= MAX && 0 <= b && b <= MAX) {
			System.out.println("OK");
		}else{
			System.out.println("NG");
		}
	}
	
	public static int parse(String s) {
		if (regex.matcher(s).matches()) {
			return Integer.parseInt(s);
		}else{
			return -1;
		}
	}

}
0