結果

問題 No.446 ゆきこーだーの雨と雪 (1)
ユーザー oemonoemon
提出日時 2016-11-18 22:37:33
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,027 bytes
コンパイル時間 657 ms
コンパイル使用メモリ 111,816 KB
実行使用メモリ 25,780 KB
最終ジャッジ日時 2024-05-04 17:53:15
合計ジャッジ時間 1,509 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
17,280 KB
testcase_01 AC 20 ms
17,408 KB
testcase_02 AC 19 ms
17,280 KB
testcase_03 AC 18 ms
17,152 KB
testcase_04 AC 19 ms
17,408 KB
testcase_05 AC 17 ms
17,152 KB
testcase_06 WA -
testcase_07 AC 19 ms
17,024 KB
testcase_08 WA -
testcase_09 AC 19 ms
17,280 KB
testcase_10 AC 19 ms
17,408 KB
testcase_11 AC 18 ms
17,152 KB
testcase_12 AC 18 ms
17,152 KB
testcase_13 AC 18 ms
17,280 KB
testcase_14 AC 19 ms
17,024 KB
testcase_15 AC 18 ms
17,408 KB
testcase_16 AC 19 ms
17,408 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;
            }

            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