結果
問題 |
No.345 最小チワワ問題
|
ユーザー |
![]() |
提出日時 | 2016-03-03 11:00:59 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 405 bytes |
コンパイル時間 | 437 ms |
コンパイル使用メモリ | 55,172 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-24 13:41:45 |
合計ジャッジ時間 | 1,271 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 15 WA * 14 |
ソースコード
// yukicoder 345 (http://yukicoder.me/problems/984) #include<iostream> #include<string> #define rep(i,a) for(int i=0;i<(a);++i) const std::string cww = "cww"; std::string S; int main() { std::cin >> S; int cnt = 0, s; rep( i, S.size() ) { if( S[i] == cww[cnt] ) { if( !cnt ) s = i; ++cnt; } if( cnt == 3 ) { printf( "%d\n", i-s+1 ); return 0; } } puts("-1"); return 0; }