結果
| 問題 |
No.345 最小チワワ問題
|
| コンテスト | |
| ユーザー |
mitsu__new
|
| 提出日時 | 2018-03-02 10:11:34 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 504 bytes |
| コンパイル時間 | 483 ms |
| コンパイル使用メモリ | 56,528 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-12-30 19:28:37 |
| 合計ジャッジ時間 | 1,636 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 15 WA * 14 |
ソースコード
#include <iostream>
#include <string>
using namespace std;
int main() {
int state,ans; //state 0:NO 1:c 2:w 3:w
string S;
cin >> S;
int i = 0;
ans = 0;
state = 0;
while(S[i]) {
switch(state) {
case 0:
if(S[i] == 'c') state = 1;
break;
case 1:
if(S[i] == 'w') state = 2;
break;
case 2:
if(S[i] == 'w') state = 3;
break;
}
if(state != 0) ans++;
if(state == 3) break;
i++;
}
if(state == 3) cout << ans << endl;
else cout << "-1" << endl;
return 0;
}
mitsu__new