結果
問題 |
No.446 ゆきこーだーの雨と雪 (1)
|
ユーザー |
|
提出日時 | 2022-12-25 11:02:50 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 26 ms / 2,000 ms |
コード長 | 1,107 bytes |
コンパイル時間 | 871 ms |
コンパイル使用メモリ | 103,296 KB |
実行使用メモリ | 18,432 KB |
最終ジャッジ日時 | 2024-11-18 22:26:46 |
合計ジャッジ時間 | 1,987 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 13 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; namespace _0446 { class Program { static void Main(string[] args) { var a = Console.ReadLine(); var b = Console.ReadLine(); int x = 0; int y = 0; var f = false; // 文字列が入っていないかをチェック if (int.TryParse(a, out x) && int.TryParse(b, out y)) { // 0<= a,b <= 12345以内かつ、先頭数値が0ではないか if(x >= 0 && x <= 12345 && y >= 0 && y <= 12345) { if (a.Length >= 2 && a.StartsWith("0") || b.Length >= 2 && b.StartsWith("0")) { Console.WriteLine("NG"); } else { Console.WriteLine("OK"); } } else { Console.WriteLine("NG"); } } else { Console.WriteLine("NG"); } } } }