結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー BantakoBantako
提出日時 2017-07-26 14:43:03
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 765 bytes
コンパイル時間 1,227 ms
コンパイル使用メモリ 158,976 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-18 00:00:52
合計ジャッジ時間 2,552 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 1 ms
6,940 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 1 ms
6,940 KB
testcase_26 AC 2 ms
6,940 KB
testcase_27 AC 1 ms
6,940 KB
testcase_28 WA -
testcase_29 AC 2 ms
6,940 KB
testcase_30 AC 2 ms
6,944 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 1 ms
6,940 KB
testcase_35 WA -
testcase_36 AC 1 ms
6,944 KB
testcase_37 AC 1 ms
6,940 KB
testcase_38 AC 1 ms
6,940 KB
testcase_39 WA -
testcase_40 AC 1 ms
6,940 KB
testcase_41 AC 1 ms
6,940 KB
testcase_42 WA -
testcase_43 AC 2 ms
6,944 KB
testcase_44 AC 1 ms
6,944 KB
testcase_45 AC 1 ms
6,944 KB
testcase_46 AC 2 ms
6,940 KB
testcase_47 WA -
testcase_48 AC 2 ms
6,940 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:3:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
    3 | main(){
      | ^~~~
main.cpp: In function ‘int main()’:
main.cpp:6:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |     scanf("%d%s%s",&N,S,S2);
      |     ~~~~~^~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<bits/stdc++.h>
int rest[15];
main(){
    int N;
    char S[15],S2[8];
    scanf("%d%s%s",&N,S,S2);
    strcat(S,S2);
    int count = 1,index = 1;
    char c = S[0];
    for(int i = 1;i < 14;i++){
        if(S[i] != c){
            rest[index] = count;
            count = 1;
            c = S[i];
            index++;
        }else{
            count++;
        }
    }
    rest[index] = count;
    int max = 0;
    int turn = S[0]=='x'?1:0;
    for(int i = 1;i < index;i++){
        if(turn){
            if(N >= rest[i]){
                max = std::max(max,rest[i-1]+rest[i]+rest[i+1]);
            }else{
                max = std::max(max,std::max(rest[i-1]+N,rest[i+1]+N));
            }
        }
        turn = !turn;
    }
    printf("%d\n",max);
}
0