結果

問題 No.346 チワワ数え上げ問題
ユーザー itezpaceitezpace
提出日時 2016-05-03 09:03:13
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 489 bytes
コンパイル時間 1,306 ms
コンパイル使用メモリ 160,116 KB
実行使用メモリ 13,760 KB
最終ジャッジ日時 2024-04-15 09:55:30
合計ジャッジ時間 6,547 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 TLE -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:26:11: warning: ‘c’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   26 |   cout << c << endl;
      |           ^
main.cpp:20:12: warning: ‘wp’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   20 |         wp *= k;
      |         ~~~^~~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

int main(){
  string s;
  cin >> s;
  int c, wc, wp, cc;
  REP(i,s.size()){
    if(s[i] == 'c'){
      wc = 0;
      FOR(j,i+1,s.size()){
        if(s[j] == 'w'){
          wc++;
          if(wc == 2) wp = 1;
        }
      }
      for(int k = wc; k > wc-2; k--){
        wp *= k;
      }
      cc = wp / 2;
      c += cc;
    }
  }
  cout << c << endl;
  return 0;
}
0