結果
問題 |
No.341 沈黙の期間
|
ユーザー |
![]() |
提出日時 | 2018-02-24 12:45:17 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 5,000 ms |
コード長 | 1,267 bytes |
コンパイル時間 | 2,252 ms |
コンパイル使用メモリ | 192,624 KB |
最終ジャッジ日時 | 2025-01-05 08:49:45 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 11 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define REP(i,a,b) for(int i=a;i<(int)b;i++) #define rep(i,n) REP(i,0,n) #define all(c) (c).begin(), (c).end() #define zero(a) memset(a, 0, sizeof a) #define minus(a) memset(a, -1, sizeof a) #define watch(a) { cout << #a << " = " << a << endl; } template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); } template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); } template<class T> void operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) cin >> e; } typedef long long ll; int const inf = 1<<29; int main() { /* std::string hoge = "…"; for (size_t i = 0; i < hoge.size(); ++i) { std::cout << "idx: " << i << ", " << std::to_string(hoge[i]) << "\n"; } idx: 0, -30 idx: 1, -128 idx: 2, -90 */ std::string s; std::cin >> s; // std::cout << s << "\n"; int ans = 0, cand = 0; int hoge = 3; for (size_t i = 0; i < s.size(); ++i) { if (i + 2 < s.size() && s[i] == -30 && s[i+1] == -128 && s[i+2] == -90) { cand++; hoge = 1; } else if (hoge < 3) { hoge++; } else { ans = max(ans, cand); cand = 0; } } ans = max(ans, cand); std::cout << ans << "\n"; return 0; }