結果

問題 No.446 ゆきこーだーの雨と雪 (1)
ユーザー 37zigen
提出日時 2016-11-17 13:51:51
言語 Java
(openjdk 23)
結果
AC  
実行時間 116 ms / 2,000 ms
コード長 724 bytes
コンパイル時間 3,151 ms
コンパイル使用メモリ 74,708 KB
実行使用メモリ 41,428 KB
最終ジャッジ日時 2024-11-26 02:49:03
合計ジャッジ時間 5,724 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

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