結果

問題 No.446 ゆきこーだーの雨と雪 (1)
ユーザー omuretsu2omuretsu2
提出日時 2017-05-24 15:00:54
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 1,108 bytes
コンパイル時間 2,129 ms
コンパイル使用メモリ 77,828 KB
実行使用メモリ 57,868 KB
最終ジャッジ日時 2023-10-19 19:59:41
合計ジャッジ時間 5,054 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 127 ms
57,476 KB
testcase_02 RE -
testcase_03 AC 127 ms
57,340 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 AC 126 ms
57,352 KB
testcase_07 WA -
testcase_08 AC 123 ms
57,084 KB
testcase_09 WA -
testcase_10 RE -
testcase_11 RE -
testcase_12 AC 127 ms
57,536 KB
testcase_13 AC 127 ms
57,336 KB
testcase_14 AC 126 ms
57,416 KB
testcase_15 AC 125 ms
57,096 KB
testcase_16 AC 128 ms
57,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.util.regex.Pattern;
import java.util.regex.Matcher;

class Sample {
	public static void main(String[] args){
		// スキャナーを定義
		Scanner scanner = new Scanner(System.in);
		// 入力値を文字列として取得
		String numberAStr = scanner.next();
		String numberBStr = scanner.next();
		// 正規表現を定義
		Pattern pattern = Pattern.compile("^[0-9a-zA-Z]*$");
		Matcher matcherA = pattern.matcher(numberAStr);
		Matcher matcherB = pattern.matcher(numberBStr);
		// 条件分岐
		if(!matcherA.matches()){
			System.out.println("NG");
		} else if (!matcherB.matches()) {
			System.out.println("NG");
		} else {
			if(numberAStr.indexOf("0")==1){
				System.out.println("NG");
			} else if(numberBStr.indexOf("0")==1){
				System.out.println("NG");
			} else {
				int numberAInt = Integer.parseInt(numberAStr);
				int numberBInt = Integer.parseInt(numberBStr);
				if(numberAInt > 12345){
					System.out.println("NG");
				} else if (numberBInt > 12345) {
					System.out.println("NG");
				} else {
					System.out.println("OK");
				}
			}
		}
	}
}

0