結果
問題 | No.446 ゆきこーだーの雨と雪 (1) |
ユーザー |
|
提出日時 | 2017-10-28 20:58:46 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 55 ms / 2,000 ms |
コード長 | 919 bytes |
コンパイル時間 | 3,240 ms |
コンパイル使用メモリ | 74,884 KB |
実行使用メモリ | 37,068 KB |
最終ジャッジ日時 | 2024-11-22 04:22:31 |
合計ジャッジ時間 | 4,875 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 13 |
ソースコード
import java.io.*;public class No446{public static void main(String[] args) throws IOException{BufferedReader br = new BufferedReader(new InputStreamReader(System.in));String a = br.readLine();String b = br.readLine();char[] A = a.toCharArray();char[] B = b.toCharArray();if(check(a, A) && check(b, B)) System.out.println("OK");else System.out.println("NG");}public static boolean check(String a, char[] A){boolean c = false;int count = 0;for(int i=0; i < A.length; i++)if(Character.isDigit(A[i])) count++;if(count == A.length){int num = Integer.parseInt(a);if(num != 0 && a.startsWith("0")) return c;else if(num == 0 && a.startsWith("00")) return c;else if(0 <= num && num <= 12345 ) c = true;}return c;}}