結果

問題 No.203 ゴールデン・ウィーク(1)
ユーザー greentea011
提出日時 2019-04-11 11:36:08
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 375 bytes
コンパイル時間 495 ms
コンパイル使用メモリ 64,512 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-18 09:03:23
合計ジャッジ時間 1,313 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23 WA * 6
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:19:16: warning: 'max' may be used uninitialized [-Wmaybe-uninitialized]
   19 |     std::cout<<max<<std::endl;
      |                ^~~
main.cpp:6:9: note: 'max' was declared here
    6 |     int max;
      |         ^~~

ソースコード

diff #

#include <iostream>
#include <string>

int main() {
    std::string s;
    int max;
    int a=0;
    while(std::getline(std::cin,s)) {
        for (auto&c:s) {
            if (c=='x') {
                max=(a>max)?a:max;
                a=0;
            }
            else if (c=='o') {
                a++;
            }
        }
    }
    std::cout<<max<<std::endl;
    
}
0