結果
問題 | No.446 ゆきこーだーの雨と雪 (1) |
ユーザー | fkwnw3_1243 |
提出日時 | 2017-05-04 11:57:43 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,296 bytes |
コンパイル時間 | 2,016 ms |
コンパイル使用メモリ | 73,480 KB |
実行使用メモリ | 49,680 KB |
最終ジャッジ日時 | 2023-10-12 07:51:23 |
合計ジャッジ時間 | 3,842 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 45 ms
49,520 KB |
testcase_01 | AC | 43 ms
49,280 KB |
testcase_02 | AC | 44 ms
49,336 KB |
testcase_03 | AC | 44 ms
49,184 KB |
testcase_04 | AC | 43 ms
49,084 KB |
testcase_05 | AC | 43 ms
49,312 KB |
testcase_06 | AC | 44 ms
49,376 KB |
testcase_07 | AC | 43 ms
49,680 KB |
testcase_08 | AC | 45 ms
49,216 KB |
testcase_09 | WA | - |
testcase_10 | AC | 45 ms
49,172 KB |
testcase_11 | AC | 45 ms
49,164 KB |
testcase_12 | AC | 44 ms
49,180 KB |
testcase_13 | AC | 44 ms
49,476 KB |
testcase_14 | AC | 44 ms
49,224 KB |
testcase_15 | AC | 43 ms
49,372 KB |
testcase_16 | AC | 48 ms
49,272 KB |
ソースコード
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import static java.lang.System.in; public class Main { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(in)); String A = reader.readLine(); String B = reader.readLine(); if (validate(A) && validate(B)) { System.out.println("OK"); } else { System.out.println("NG"); } } private static boolean validate(String s) { boolean isNumber = true; if (s.length() >= 2 && s.charAt(0) == '0' && s.charAt(1) == '0') { isNumber = false; } else { for (int i = 0; i < s.length(); i++) { if (!Character.isDigit(s.charAt(i))) { isNumber = false; break; } } } int upperBound = 12345; int lowerBound = 0; if (isNumber) { int number = Integer.parseInt(s); if (lowerBound <= number && number <= upperBound) { return true; } else { return false; } } else { return false; } } }