結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー AreTrashAreTrash
提出日時 2016-05-03 13:13:23
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 59 ms / 1,000 ms
コード長 1,615 bytes
コンパイル時間 4,318 ms
コンパイル使用メモリ 103,040 KB
実行使用メモリ 23,592 KB
最終ジャッジ日時 2023-08-25 23:48:58
合計ジャッジ時間 8,474 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
21,536 KB
testcase_01 AC 56 ms
21,436 KB
testcase_02 AC 57 ms
21,552 KB
testcase_03 AC 57 ms
21,544 KB
testcase_04 AC 57 ms
19,460 KB
testcase_05 AC 57 ms
23,484 KB
testcase_06 AC 57 ms
23,560 KB
testcase_07 AC 57 ms
21,492 KB
testcase_08 AC 56 ms
21,596 KB
testcase_09 AC 57 ms
19,488 KB
testcase_10 AC 58 ms
23,560 KB
testcase_11 AC 58 ms
19,572 KB
testcase_12 AC 56 ms
21,532 KB
testcase_13 AC 57 ms
21,440 KB
testcase_14 AC 57 ms
23,532 KB
testcase_15 AC 57 ms
21,480 KB
testcase_16 AC 57 ms
21,436 KB
testcase_17 AC 56 ms
21,628 KB
testcase_18 AC 56 ms
21,436 KB
testcase_19 AC 56 ms
21,532 KB
testcase_20 AC 57 ms
23,536 KB
testcase_21 AC 57 ms
21,432 KB
testcase_22 AC 57 ms
23,552 KB
testcase_23 AC 57 ms
21,520 KB
testcase_24 AC 57 ms
21,544 KB
testcase_25 AC 59 ms
21,436 KB
testcase_26 AC 59 ms
21,464 KB
testcase_27 AC 57 ms
21,488 KB
testcase_28 AC 57 ms
21,492 KB
testcase_29 AC 57 ms
21,360 KB
testcase_30 AC 56 ms
19,332 KB
testcase_31 AC 57 ms
21,508 KB
testcase_32 AC 57 ms
23,592 KB
testcase_33 AC 56 ms
21,452 KB
testcase_34 AC 57 ms
21,608 KB
testcase_35 AC 56 ms
19,412 KB
testcase_36 AC 57 ms
23,592 KB
testcase_37 AC 57 ms
21,436 KB
testcase_38 AC 57 ms
21,496 KB
testcase_39 AC 57 ms
23,416 KB
testcase_40 AC 57 ms
21,640 KB
testcase_41 AC 56 ms
21,480 KB
testcase_42 AC 56 ms
21,500 KB
testcase_43 AC 58 ms
23,556 KB
testcase_44 AC 57 ms
21,532 KB
testcase_45 AC 56 ms
21,504 KB
testcase_46 AC 58 ms
23,536 KB
testcase_47 AC 57 ms
23,528 KB
testcase_48 AC 57 ms
21,592 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

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);
        }
    }
}
0