結果
問題 |
No.345 最小チワワ問題
|
ユーザー |
![]() |
提出日時 | 2019-06-15 22:16:25 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 467 bytes |
コンパイル時間 | 690 ms |
コンパイル使用メモリ | 63,552 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-21 06:42:18 |
合計ジャッジ時間 | 2,940 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 RE * 1 |
other | AC * 21 RE * 8 |
ソースコード
#include <iostream> #include <string> #include <vector> #include <algorithm> using namespace std; int main() { string s; vector<int> len; cin >> s; for (int i=0; i<s.size(); i++) { int flg=0; if (s[i]=='c') { for (int j=i+1; j<s.size(); j++) { if (s[j]=='w') flg++; if (flg==2) { len.push_back(j-i+1); break; } } } } printf("%d\n", *min_element(len.begin(), len.end())); return 0; }