2019 google kt H轮,求大佬帮忙看看

新手第一次做这个,一道题都没做出来😂,求大佬帮忙看看第一道的代码,不懂啥问题,提交WA
#include<iostream>

using namespace std;

const int N = 1e5 +10;
int a[N];
int main(){
    int tc;
    cin>>tc;
    for(int t = 1;t<=tc;t++){
        cout<<"Case #"<<t<<":";
        int n;
        cin >>n;
        int point = 0;
        int c = 1;
        for(int i= 1;i<=n;++i){
            int temp=0;
            cin >> a[i];
            for(int j=1;j<=i;++j){
            if(a[j]>=c)temp+=1;
            }
            if(temp> point){
                point = temp;
                c+=1; 
            }
            cout<<point<<" ";
        }
        cout<<"\n";
}
    return 0;
}


#google##笔试题目#
全部评论
可以用小顶堆,也可以用树状数组+二分
点赞 回复
分享
发布于 2019-11-17 22:08

相关推荐

点赞 1 评论
分享
牛客网
牛客企业服务