結果
| 問題 | No.653 E869120 and Lucky Numbers | 
| コンテスト | |
| ユーザー |  バカらっく | 
| 提出日時 | 2018-02-23 23:00:56 | 
| 言語 | C#(csc) (csc 3.9.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 2,107 bytes | 
| コンパイル時間 | 1,124 ms | 
| コンパイル使用メモリ | 112,988 KB | 
| 実行使用メモリ | 28,912 KB | 
| 最終ジャッジ日時 | 2024-10-09 20:39:23 | 
| 合計ジャッジ時間 | 3,446 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 28 WA * 3 | 
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;
public class Program
{
    public void Proc()
    {
        List<int> inpt = Reader.ReadLine().Select(a => int.Parse(a.ToString())).Reverse().ToList();
        string ans = IsValid(inpt)?"Yes":"No";
        Console.WriteLine(ans);
    }
    private bool IsValid(List<int> inpt) {
        bool kuri = false;
        for (int i = 0; i < inpt.Count - 1; i++)
        {
            int num = inpt[i];
            if(kuri) {
                if(num>0) {
                    num--;
                    kuri = false;
                } else {
                    num = 9;
                }
            }
            if(num == 6 || num == 7) {
                for (int j = i + 1; i < inpt.Count; i++) {
                    if(inpt[j]!=6&&inpt[j]!=7) {
                        return false;
                    }
                }
                return true;
            } else if(num == 2 || num == 3 || num == 4) {
                if(i==inpt.Count-2) {
                    if(inpt.Last() == 1) {
                        return true;
                    } else {
                        return false;
                    }
                } else {
                    kuri = true;
                }
            } else {
                return false;
            }
        }
        return true;
    }
    public class Reader
    {
        private static StringReader sr;
        public static bool IsDebug = false;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (sr == null)
                {
                    sr = new StringReader(InputText.Trim());
                }
                return sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
        private static string InputText = @"
123
";
    }
    public static void Main(string[] args)
    {
#if DEBUG
        Reader.IsDebug = true;
#endif
        Program prg = new Program();
        prg.Proc();
    }
}
            
            
            
        