結果
| 問題 |
No.345 最小チワワ問題
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-03-11 19:46:43 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 544 bytes |
| コンパイル時間 | 432 ms |
| コンパイル使用メモリ | 55,416 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-15 00:24:37 |
| 合計ジャッジ時間 | 1,412 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 15 WA * 14 |
ソースコード
#include <iostream>
#include <string>
using namespace std;
int main(){
int pos_c = 0;
string cww = "cww";
string s; cin >> s;
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;
}