結果
問題 |
No.204 ゴールデン・ウィーク(2)
|
ユーザー |
![]() |
提出日時 | 2016-05-03 13:13:23 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 49 ms / 1,000 ms |
コード長 | 1,615 bytes |
コンパイル時間 | 3,070 ms |
コンパイル使用メモリ | 115,768 KB |
実行使用メモリ | 26,608 KB |
最終ジャッジ日時 | 2024-12-24 11:52:49 |
合計ジャッジ時間 | 5,531 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 46 |
コンパイルメッセージ
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; using System.Linq; 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; if(god != 0){ for(var i = 0; i < fuckingDays.Count; i++){ if(1<= fuckingDays[i] && fuckingDays[i] <= god) max = Math.Max(max, happyDays[i - 1] + happyDays[i] + fuckingDays[i]); if(fuckingDays[i] > god) max = Math.Max(max, Math.Max(happyDays[i - 1] + god, happyDays[i] + god)); } } else{ max = happyDays.Max(); } Console.WriteLine(max); } } }