結果

問題 No.446 ゆきこーだーの雨と雪 (1)
ユーザー 37zigen37zigen
提出日時 2016-11-17 13:51:51
言語 Java19
(openjdk 21)
結果
AC  
実行時間 122 ms / 2,000 ms
コード長 724 bytes
コンパイル時間 3,376 ms
コンパイル使用メモリ 71,832 KB
実行使用メモリ 55,936 KB
最終ジャッジ日時 2023-08-17 07:52:36
合計ジャッジ時間 6,528 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
55,844 KB
testcase_01 AC 117 ms
55,620 KB
testcase_02 AC 120 ms
55,596 KB
testcase_03 AC 120 ms
55,936 KB
testcase_04 AC 122 ms
55,880 KB
testcase_05 AC 121 ms
53,408 KB
testcase_06 AC 121 ms
55,868 KB
testcase_07 AC 119 ms
55,812 KB
testcase_08 AC 121 ms
55,616 KB
testcase_09 AC 119 ms
55,604 KB
testcase_10 AC 119 ms
55,556 KB
testcase_11 AC 117 ms
55,768 KB
testcase_12 AC 117 ms
55,712 KB
testcase_13 AC 121 ms
55,916 KB
testcase_14 AC 121 ms
55,404 KB
testcase_15 AC 122 ms
55,392 KB
testcase_16 AC 117 ms
55,640 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;

import java.util.Scanner;

public class Q446 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		boolean correct = true;
		for (int t = 0; t < 2; ++t) {
			char[] s = sc.next().toCharArray();
			for (int i = 0; i < s.length; ++i) {
				if (s[i] - '0' > 9 || s[i] - '0' < 0)
					correct = false;
			}

			if (s.length >= 2 && s[0] - '0' == 0) {
				correct = false;
			}

			int digit = 0;
			if (correct) {
				for (int i = 0; i < s.length; ++i) {
					digit = 10 * digit + (s[i] - '0');
				}

				if (digit > 12345) {
					correct = false;
				}
			}
		}

		if (correct) {
			System.out.println("OK");
		} else {
			System.out.println("NG");
		}

		sc.close();

	}
}
0