結果
| 問題 |
No.204 ゴールデン・ウィーク(2)
|
| コンテスト | |
| ユーザー |
AreTrash
|
| 提出日時 | 2016-05-03 13:04:27 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,388 bytes |
| コンパイル時間 | 832 ms |
| コンパイル使用メモリ | 114,512 KB |
| 実行使用メモリ | 25,848 KB |
| 最終ジャッジ日時 | 2024-10-13 14:01:29 |
| 合計ジャッジ時間 | 3,478 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 35 WA * 6 RE * 5 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.Collections.Generic;
namespace No204_1{
public class Program{
public static void Main(string[] args){
var god = int.Parse(Console.ReadLine());
var days = string.Empty;
days += "\0xxxxxxxxxxxxxx";
days += Console.ReadLine();
days += Console.ReadLine();
days += "xxxxxxxxxxxxxx\0";
var happyDays = new List<int>{0};
var fuckingDays = new List<int>{0};
var cntx = 0;
var cnto = 0;
foreach(var day in days){
if(day == 'x'){
cntx++;
} else if(cntx != 0){
fuckingDays.Add(cntx);
cntx = 0;
}
if(day == 'o'){
cnto++;
} else if(cnto != 0){
happyDays.Add(cnto);
cnto = 0;
}
}
happyDays.Add(0);
fuckingDays.Add(0);
var max = 0;
for(var i = 0; i < fuckingDays.Count; i++){
if(fuckingDays[i] == god) max = Math.Max(max, happyDays[i - 1] + happyDays[i]);
if(fuckingDays[i] > god) max = Math.Max(max, Math.Max(happyDays[i - 1], happyDays[i]));
}
Console.WriteLine(max + god);
}
}
}
AreTrash