結果
問題 |
No.653 E869120 and Lucky Numbers
|
ユーザー |
![]() |
提出日時 | 2018-02-27 22:43:39 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,044 bytes |
コンパイル時間 | 981 ms |
コンパイル使用メモリ | 108,544 KB |
実行使用メモリ | 19,424 KB |
最終ジャッジ日時 | 2024-11-30 11:59:02 |
合計ジャッジ時間 | 3,087 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 22 WA * 9 |
コンパイルメッセージ
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() { int[] inpt = Reader.ReadLine().Reverse().Select(a=>int.Parse(a.ToString())).ToArray(); string ans = "No"; if(IsValid(inpt)) { ans = "Yes"; } Console.WriteLine(ans); } private bool IsValid(int[] inpt) { for (int i = 0; i < inpt.Length; i++) { int num = inpt[i]; if(i==0) { if(num >=2&&num<=4) { continue; } else { return false; } } else if(i == inpt.Length - 1) { if(num==1) { return true; } else { return false; } } else { if(num >= 3&&num<=5) { continue; } else if(num == 7 || num == 8) { for (int j = i + 1; j < inpt.Length; j++) { if(inpt[j] != 6 && inpt[j] != 7) { return false; } } return true; } } } return true; } public class Reader { 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 = @" 155555555555555555555555 "; } public static void Main(string[] args) { #if DEBUG Reader.IsDebug = true; #endif Program prg = new Program(); prg.Proc(); } }