結果
問題 |
No.345 最小チワワ問題
|
ユーザー |
![]() |
提出日時 | 2016-02-26 22:54:28 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 423 bytes |
コンパイル時間 | 1,217 ms |
コンパイル使用メモリ | 157,844 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-22 22:29:16 |
合計ジャッジ時間 | 2,183 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 14 WA * 15 |
ソースコード
#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++; cnt++; } ans = min(cnt, ans); } if (ans > 100) puts("-1"); else printf("%lld\n", ans); return 0; }