結果
問題 |
No.345 最小チワワ問題
|
ユーザー |
![]() |
提出日時 | 2016-02-26 22:57:36 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 471 bytes |
コンパイル時間 | 1,309 ms |
コンパイル使用メモリ | 158,080 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-22 22:36:24 |
合計ジャッジ時間 | 2,247 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 15 WA * 14 |
ソースコード
#define _USE_MATH_DEFINES #include<bits/stdc++.h> using namespace std; #define int long long string S; signed main() { cin >> S; int ans = 101; for (int i = 0; i < S.size(); i++) { if (S[i] != 'c') continue; int cnt = 0; for (int j = 0; j < 2; j++) { while (i < S.size() && S[i] != 'w') cnt++, i++; if (i >= S.size()) goto NEXT; cnt++; i++; } ans = min(cnt, ans); NEXT:; } if (ans > 100) puts("-1"); else printf("%lld\n", ans); return 0; }