結果
| 問題 |
No.653 E869120 and Lucky Numbers
|
| コンテスト | |
| ユーザー |
バカらっく
|
| 提出日時 | 2018-02-23 23:02:38 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 2,188 bytes |
| コンパイル時間 | 1,046 ms |
| コンパイル使用メモリ | 118,100 KB |
| 実行使用メモリ | 27,108 KB |
| 最終ジャッジ日時 | 2024-11-29 05:08:55 |
| 合計ジャッジ時間 | 3,333 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 WA * 2 |
コンパイルメッセージ
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) {
if(i==0) {
return false;
}
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 = @"
77784
";
}
public static void Main(string[] args)
{
#if DEBUG
Reader.IsDebug = true;
#endif
Program prg = new Program();
prg.Proc();
}
}
バカらっく