結果
| 問題 |
No.345 最小チワワ問題
|
| コンテスト | |
| ユーザー |
hogeover30
|
| 提出日時 | 2016-02-27 01:12:58 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 412 bytes |
| コンパイル時間 | 469 ms |
| コンパイル使用メモリ | 57,688 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-25 11:27:42 |
| 合計ジャッジ時間 | 1,443 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
string s;
cin>>s;
unsigned res=-1;
for(int i=0;i<s.size();++i) {
if (s[i]=='c') {
int cnt=0;
for(int j=i+1;j<s.size();++j) {
if (s[j]=='w') ++cnt;
if (cnt==2) res=min(res, j-i+1u);
}
}
}
cout<<(int)res<<endl;
}
hogeover30