結果
| 問題 |
No.653 E869120 and Lucky Numbers
|
| コンテスト | |
| ユーザー |
AreTrash
|
| 提出日時 | 2018-03-02 16:40:34 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 723 bytes |
| コンパイル時間 | 932 ms |
| コンパイル使用メモリ | 107,392 KB |
| 実行使用メモリ | 25,984 KB |
| 最終ジャッジ日時 | 2024-06-11 15:43:34 |
| 合計ジャッジ時間 | 2,952 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 WA * 7 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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[] {2, 3, 4}.Select(x => x + up).Contains(P[digit])) return dfs(digit + 1, 1);
if (digit == 0) return false;
if (new[] {0, 6, 7}.Select(x => x + up).Contains(P[digit])) return dfs(digit + 1, 0);
return false;
};
Console.WriteLine(dfs(0, 0) ? "Yes" : "No");
}
}
}
AreTrash