結果
| 問題 |
No.345 最小チワワ問題
|
| コンテスト | |
| ユーザー |
tenkyu9
|
| 提出日時 | 2018-01-22 01:58:20 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 596 bytes |
| コンパイル時間 | 628 ms |
| コンパイル使用メモリ | 68,980 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-25 22:03:23 |
| 合計ジャッジ時間 | 1,622 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 15 WA * 14 |
ソースコード
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include<cstring>
using namespace std;
int main(){
string s;
int ans;
cin >> s;
for(int i=0; i<s.size(); i++){
if(s[i]=='c'){
ans=1;
for(int j=i+1; j<s.size(); j++){
ans++;
if(s[j]=='w'){
for(int k=j+1; k<s.size(); k++){
ans++;
if(s[k]=='w'){
cout << ans << endl;
return 0;
}
}
}
}
}
}
cout << -1 << endl;
return 0;
}
tenkyu9