結果
問題 |
No.345 最小チワワ問題
|
ユーザー |
|
提出日時 | 2018-03-11 19:46:03 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 567 bytes |
コンパイル時間 | 501 ms |
コンパイル使用メモリ | 55,380 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-15 00:24:33 |
合計ジャッジ時間 | 1,516 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | WA * 29 |
ソースコード
#include <iostream> #include <string> using namespace std; int main(){ int pos_c = 0; string cww = "cww"; string s; cin >> s; cout << s << endl; if(s.length() < 3){ cout << -1 << endl; return 0; } for(int i=0, j=0; i < s.length(); i++){ if(s[i] == cww[j]){ j++; if(1 == j) pos_c = i; if(3 == j){ cout << i - pos_c + 1 << endl; return 0; } } } cout << -1 << endl; return 0; }