結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー AreTrashAreTrash
提出日時 2016-05-03 13:04:27
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,388 bytes
コンパイル時間 849 ms
コンパイル使用メモリ 104,832 KB
実行使用メモリ 17,920 KB
最終ジャッジ日時 2024-04-21 15:13:09
合計ジャッジ時間 3,243 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 23 ms
17,536 KB
testcase_02 AC 23 ms
17,664 KB
testcase_03 AC 23 ms
17,664 KB
testcase_04 AC 24 ms
17,664 KB
testcase_05 AC 23 ms
17,536 KB
testcase_06 AC 23 ms
17,664 KB
testcase_07 AC 23 ms
17,792 KB
testcase_08 AC 23 ms
17,536 KB
testcase_09 AC 23 ms
17,536 KB
testcase_10 AC 23 ms
17,536 KB
testcase_11 AC 23 ms
17,536 KB
testcase_12 AC 23 ms
17,664 KB
testcase_13 AC 23 ms
17,664 KB
testcase_14 AC 23 ms
17,536 KB
testcase_15 AC 23 ms
17,408 KB
testcase_16 AC 24 ms
17,664 KB
testcase_17 AC 23 ms
17,536 KB
testcase_18 AC 23 ms
17,536 KB
testcase_19 AC 23 ms
17,280 KB
testcase_20 AC 23 ms
17,792 KB
testcase_21 AC 24 ms
17,536 KB
testcase_22 AC 23 ms
17,664 KB
testcase_23 AC 23 ms
17,664 KB
testcase_24 AC 23 ms
17,408 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 24 ms
17,664 KB
testcase_29 AC 24 ms
17,792 KB
testcase_30 AC 23 ms
17,536 KB
testcase_31 AC 23 ms
17,536 KB
testcase_32 AC 23 ms
17,536 KB
testcase_33 AC 23 ms
17,664 KB
testcase_34 AC 23 ms
17,536 KB
testcase_35 RE -
testcase_36 RE -
testcase_37 AC 23 ms
17,664 KB
testcase_38 AC 23 ms
17,536 KB
testcase_39 AC 24 ms
17,536 KB
testcase_40 RE -
testcase_41 WA -
testcase_42 AC 22 ms
17,664 KB
testcase_43 RE -
testcase_44 RE -
testcase_45 AC 23 ms
17,664 KB
testcase_46 AC 23 ms
17,664 KB
testcase_47 AC 23 ms
17,536 KB
testcase_48 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;

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