結果
問題 | No.345 最小チワワ問題 |
ユーザー |
![]() |
提出日時 | 2016-03-11 20:55:56 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 411 bytes |
コンパイル時間 | 731 ms |
コンパイル使用メモリ | 59,924 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-25 11:38:27 |
合計ジャッジ時間 | 1,572 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
#include <iostream> #include <cmath> using namespace std; #define rep(i,n) for(int i = 0; i < (int)(n); ++i) string s; int main(){ while(cin >> s){ int ans = 1e9; rep(i,s.size())rep(j,i)rep(k,j){ if(s[k] == 'c' && s[j] == 'w' && s[i] == 'w'){ ans = min(ans, i-k+1); } } if(ans == 1e9) ans = -1; cout << ans << endl; } }