結果
問題 |
No.345 最小チワワ問題
|
ユーザー |
![]() |
提出日時 | 2016-09-27 18:55:53 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 638 bytes |
コンパイル時間 | 752 ms |
コンパイル使用メモリ | 79,580 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-21 07:19:38 |
合計ジャッジ時間 | 1,764 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 WA * 19 |
ソースコード
#include<stdio.h> #include <vector> #include <list> #include <map> #include <set> #include <queue> #include <stack> #include <algorithm> #include <sstream> #include <iostream> #include <string> #include <stdio.h> using namespace std; int main() { string S; cin >> S; int ans = 0, sta = 0; for (int l = 0; l < S.size(); l++) { if (S[l] == 'c') { for (int r = S.size(); r >= l+1; r--) { if (S[r] == 'w') { for (int m = l+1; m < r; m++) { if (S[m] == 'w') { ans = max(ans, r-l+1); break; } } } } } } if (ans == 0) cout << -1 << endl; else cout << ans << endl; return 0; }