1 条题解

  • 1
    @ 2024-8-19 11:59:32

    这个题目其实比想象中的简单,因为我们只需要使用桶排序来记录每位学生的分数,然后再对其进行处理就可以得出即时的分数线。

    AC code

    #include <bits/stdc++.h>
    using namespace std;
    int t[610];
    int n,w; 
    int main(){
    	int x;
    	cin>>n>>w;
    	for(int i=1;i<=n;i++){
    		cin>>x;
    		t[x]++;
    		int sum=0;
    		for(int j=600;j>=0;j--){
    			sum+=t[j];
    			if(sum>=max(1,i*w/100)){
    				cout<<j<<' ';
    				break;
    			}
    		}
    	}
    	return 0;
    }
    

    信息

    ID
    634
    时间
    1000ms
    内存
    256MiB
    难度
    7
    标签
    递交数
    146
    已通过
    29
    上传者