結果

問題 No.446 ゆきこーだーの雨と雪 (1)
ユーザー YamaKasa
提出日時 2018-05-24 23:43:19
言語 Java
(openjdk 23)
結果
AC  
実行時間 115 ms / 2,000 ms
コード長 726 bytes
コンパイル時間 1,845 ms
コンパイル使用メモリ 74,428 KB
実行使用メモリ 41,784 KB
最終ジャッジ日時 2024-06-28 17:35:00
合計ジャッジ時間 4,449 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String A = scan.next();
		String B = scan.next();
		scan.close();
		if(isNumber(A) && isNumber(B)) {
			int a = Integer.parseInt(A);
			int b = Integer.parseInt(B);
			System.out.println("OK");
		}else {
			System.out.println("NG");
		}
	}
	public static boolean isNumber(String num) {
	    try {
	    	if(num.length() > 1 && num.substring(0, 1).equals("0")) {
	        	return false;
	    	}
	        int t = Integer.parseInt(num);
	        if(t > 12345) {
	        	return false;
	        }
	        return true;
	        } catch (NumberFormatException e) {
	        return false;
	    }
	}
}
0