1 条题解

  • 0
    @ 2026-07-16 16:56:37
    #pragma GCC optimize("O3")
    
    #include<bits/stdc++.h>
    using namespace std;
    
    signed main() {
        
        ios::sync_with_stdio(0);
        cin.tie(nullptr);
        
        int tt; cin >> tt;
        
        while(tt --) {
            int n; cin >> n;
            string s; cin >> s, s += '*';
            
            int last = 0, ans = 0;
            for(int i = 0;i <= n;i ++) {
                if(s[i] == '#') last ++;
                else if(s[i] == '*') {
                    ans = max(ans, last);
                    last = 0;
                }
            }
            
            cout << (ans + 1) / 2 << endl;
        }
        
        return 0;
        
    }
    
  • 1

信息

ID
1000
难度
1
分类
枚举贪心 | 模拟 | 字符串 点击显示
标签
递交数
3
已通过
2
通过率
67%
上传者