結果
| 問題 |
No.345 最小チワワ問題
|
| コンテスト | |
| ユーザー |
keisuke6
|
| 提出日時 | 2022-08-17 11:03:51 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 320 bytes |
| コンパイル時間 | 1,927 ms |
| コンパイル使用メモリ | 192,620 KB |
| 最終ジャッジ日時 | 2025-01-30 23:24:33 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
int ans = 10000;
string S;
cin>>S;
int N = S.size();
for(int i=0;i<N;i++)for(int j=i+1;j<N;j++)for(int k=j+1;k<N;k++)if(S[i] == 'c' && S[j] == 'w' && S[k] == 'w') ans = min({ans,k-i+1});
cout<<ans-(ans==10000)*10001<<endl;
}
keisuke6