結果

問題 No.446 ゆきこーだーの雨と雪 (1)
ユーザー oemonoemon
提出日時 2016-11-18 22:43:05
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 55 ms / 2,000 ms
コード長 1,084 bytes
コンパイル時間 2,919 ms
コンパイル使用メモリ 102,288 KB
実行使用メモリ 22,652 KB
最終ジャッジ日時 2023-08-17 11:11:32
合計ジャッジ時間 4,044 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
22,632 KB
testcase_01 AC 54 ms
20,532 KB
testcase_02 AC 49 ms
22,500 KB
testcase_03 AC 54 ms
20,600 KB
testcase_04 AC 55 ms
20,788 KB
testcase_05 AC 55 ms
20,672 KB
testcase_06 AC 54 ms
20,612 KB
testcase_07 AC 50 ms
20,376 KB
testcase_08 AC 53 ms
20,776 KB
testcase_09 AC 49 ms
20,380 KB
testcase_10 AC 53 ms
20,812 KB
testcase_11 AC 50 ms
20,620 KB
testcase_12 AC 53 ms
20,736 KB
testcase_13 AC 53 ms
20,844 KB
testcase_14 AC 54 ms
22,652 KB
testcase_15 AC 55 ms
20,768 KB
testcase_16 AC 54 ms
20,732 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            var A = Console.ReadLine();
            var B = Console.ReadLine();

            var result = IsValid(A) && IsValid(B)
                ? "OK" : "NG";

            Console.Write(result);
        }

        static bool IsValid(string value)
        {
            for (var i = 0; i < value.Length; i++)
            {
                var v = value[i];
                if (!IsNumber(v)) return false;
                if (i == 0 && v == '0' && value.Length != 1) return false;
            }

            if (int.Parse(value) > 12345) return false;

            return true;
        }

        static bool IsNumber(char value)
        {
            return value == '1'
                || value == '2'
                || value == '3'
                || value == '4'
                || value == '5'
                || value == '6'
                || value == '7'
                || value == '8'
                || value == '9'
                || value == '0';
        }
    }
}
0