結果

問題 No.653 E869120 and Lucky Numbers
ユーザー AreTrashAreTrash
提出日時 2018-03-02 16:46:55
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 740 bytes
コンパイル時間 2,263 ms
コンパイル使用メモリ 104,704 KB
実行使用メモリ 23,740 KB
最終ジャッジ日時 2023-09-02 08:59:20
合計ジャッジ時間 6,392 ms
ジャッジサーバーID
(参考情報)
judge16 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
21,596 KB
testcase_01 AC 60 ms
23,496 KB
testcase_02 AC 60 ms
19,596 KB
testcase_03 AC 60 ms
21,628 KB
testcase_04 AC 59 ms
23,588 KB
testcase_05 AC 60 ms
21,500 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 61 ms
21,632 KB
testcase_09 WA -
testcase_10 AC 59 ms
23,496 KB
testcase_11 WA -
testcase_12 AC 59 ms
21,504 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 58 ms
21,456 KB
testcase_18 AC 60 ms
23,496 KB
testcase_19 AC 59 ms
21,476 KB
testcase_20 AC 59 ms
21,432 KB
testcase_21 AC 59 ms
21,504 KB
testcase_22 AC 59 ms
21,484 KB
testcase_23 WA -
testcase_24 AC 58 ms
21,592 KB
testcase_25 AC 57 ms
21,452 KB
testcase_26 AC 59 ms
21,536 KB
testcase_27 AC 59 ms
23,492 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 63 ms
23,424 KB
testcase_31 AC 58 ms
23,644 KB
testcase_32 WA -
testcase_33 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Linq;

namespace No653
{
    class Program
    {
        static void Main(string[] args)
        {
            var P = Console.ReadLine().Reverse().Select(c => c - '0').ToArray();

            Func<int, int, bool> dfs = null;
            dfs = (digit, up) =>
            {
                if (digit >= P.Length) return true;
                if (new[] { 0, 6, 7 }.Select(x => x + up).Contains(P[digit])) return dfs(digit + 1, 0);
                if (digit == 0) return false;
                if (new[] { 2, 3, 4 }.Select(x => x + up).Contains(P[digit])) return dfs(digit + 1, 1);
                return false;
            };

            Console.WriteLine(P[0] != 0 && dfs(0, 0) ? "Yes" : "No");
        }
    }
}
0