結果
問題 | No.345 最小チワワ問題 |
ユーザー |
|
提出日時 | 2024-11-13 09:29:32 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 472 bytes |
コンパイル時間 | 871 ms |
コンパイル使用メモリ | 80,644 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-13 09:29:34 |
合計ジャッジ時間 | 2,126 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
#include <iostream>using namespace std;int main() {string s;cin >> s;int min = 2100000000;int len=s.size();for(int i=0; i<len-2; i++){for(int j=i+1; j<len-1; j++){for(int k=j+1; k<len; k++){if(s[i]=='c'&&s[j]=='w'&&s[k]=='w'){if(min > ((k-i)+1))min = (k-i)+1;}}}}if(min == 2100000000)cout << -1;else cout << min;return 0;}