結果
問題 |
No.345 最小チワワ問題
|
ユーザー |
![]() |
提出日時 | 2016-02-26 22:47:41 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 369 bytes |
コンパイル時間 | 1,206 ms |
コンパイル使用メモリ | 157,776 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-22 22:17:52 |
合計ジャッジ時間 | 2,219 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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 f = 0, ans = 1, p = 0; while (f < S.size() && S[f++] != 'c') ; for (int i = f; i < S.size(); i++) { ans++; if (S[i] == 'w') { if (++p >= 2) break; } } if (p < 2) puts("-1"); else printf("%lld\n", ans); return 0; }