結果

問題 No.653 E869120 and Lucky Numbers
ユーザー AreTrashAreTrash
提出日時 2018-03-02 17:37:25
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 62 ms / 2,000 ms
コード長 797 bytes
コンパイル時間 3,498 ms
コンパイル使用メモリ 107,384 KB
実行使用メモリ 24,184 KB
最終ジャッジ日時 2023-10-11 19:26:57
合計ジャッジ時間 5,857 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
23,448 KB
testcase_01 AC 60 ms
21,480 KB
testcase_02 AC 59 ms
21,480 KB
testcase_03 AC 59 ms
21,532 KB
testcase_04 AC 60 ms
23,532 KB
testcase_05 AC 59 ms
21,484 KB
testcase_06 AC 59 ms
21,648 KB
testcase_07 AC 58 ms
21,476 KB
testcase_08 AC 60 ms
23,524 KB
testcase_09 AC 58 ms
23,660 KB
testcase_10 AC 58 ms
21,572 KB
testcase_11 AC 58 ms
21,500 KB
testcase_12 AC 58 ms
21,664 KB
testcase_13 AC 57 ms
21,528 KB
testcase_14 AC 57 ms
23,596 KB
testcase_15 AC 59 ms
21,720 KB
testcase_16 AC 59 ms
23,620 KB
testcase_17 AC 57 ms
23,536 KB
testcase_18 AC 57 ms
21,456 KB
testcase_19 AC 59 ms
21,408 KB
testcase_20 AC 58 ms
23,464 KB
testcase_21 AC 58 ms
23,448 KB
testcase_22 AC 57 ms
21,452 KB
testcase_23 AC 57 ms
21,544 KB
testcase_24 AC 57 ms
21,408 KB
testcase_25 AC 57 ms
21,616 KB
testcase_26 AC 57 ms
21,580 KB
testcase_27 AC 58 ms
23,460 KB
testcase_28 AC 62 ms
22,152 KB
testcase_29 AC 62 ms
22,076 KB
testcase_30 AC 61 ms
24,184 KB
testcase_31 AC 57 ms
21,524 KB
testcase_32 AC 56 ms
21,556 KB
testcase_33 AC 58 ms
21,556 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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, bool> dfs = null;
            dfs = digit =>
            {
                if (digit >= P.Length) return false;
                if (P[digit] == 1 && digit + 1 == P.Length) return true;
                if (P[digit] == 7 || P[digit] == 8) return P.Skip(digit + 1).All(x => x == 6 || x == 7);
                if (new[] { 3, 4, 5 }.Contains(P[digit])) return dfs(digit + 1);
                return false;
            };

            var res = new[] {2, 3, 4}.Contains(P[0]) && P.Length >= 2 && dfs(1);
            Console.WriteLine(res ? "Yes" : "No");
        }
    }
}
0