結果

問題 No.436 ccw
コンテスト
ユーザー toto6114
提出日時 2019-07-04 20:50:44
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 281 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 525 ms
コンパイル使用メモリ 87,408 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-04-07 14:27:24
合計ジャッジ時間 3,673 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 24
権限があれば一括ダウンロードができます
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/string:53,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/locale_classes.h:42,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/ios_base.h:43,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/ios:46,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/ostream.h:43,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/ostream:42,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/iostream:43,
                 from main.cpp:1:
In function 'constexpr const _Tp& std::min(const _Tp&, const _Tp&) [with _Tp = int]',
    inlined from 'int main()' at main.cpp:16:14:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/stl_algobase.h:239:7: warning: 'c' may be used uninitialized [-Wmaybe-uninitialized]
  239 |       if (__b < __a)
      |       ^~
main.cpp: In function 'int main()':
main.cpp:6:9: note: 'c' was declared here
    6 |     int c,w;
      |         ^
In function 'constexpr const _Tp& std::min(const _Tp&, const _Tp&) [with _Tp = int]',
    inlined from 'int main()' at main.cpp:16:14:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/stl_algobase.h:239:7: warning: 'w' may be used uninitialized [-Wmaybe-uninitialized]
  239 |       if (__b < __a)
      |       ^~
main.cpp: In function 'int main()':
main.cpp:6:11: note: 'w' was declared here
    6 |     int c,w;
      |           ^

ソースコード

diff #
raw source code

#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
    int c,w;
  string s;
  cin >> s;
  for(int i=0; i<s.size(); i++) {
      if(s[i]=='w') {
          w=s.size()-i;
          c=i-1;
          break;
      }
  }
  cout << min(c,w) << endl;
}
0