0
点赞
收藏
分享

微信扫一扫

C. Dolce Vita

一世独秀 2022-04-23 阅读 72
c++
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int t=0;
    cin>>t;
    while(t--){
        int n=0,x=0,a[200005],y=0;
        cin>>n>>x;
        for(int i=0;i<n;i++) cin>>a[i];
        //此前为输入

        sort(a,a+n);
        int q=a[0];
        for(int i=0;i<x-q+1;i++){
            for(int j=0,s=0;j<n;j++){
                if(s+a[j]<=x){
                   s+=a[j]; 
                   y++;
                }else break;
            }
            
            for(int j=0;j<n;j++) a[j]++;
        }
        cout<<y<<endl;
    }
    return 0;
}

我这是模拟,时间会超限太晚了,明天更正(思路是按店数遍历,不要按天数)

举报

相关推荐

Codeforces-1671 C: Dolce Vita

C. digitnum

C. Ilya and Matrix

C.开餐馆

C. Detective Task

C. Make Good

C. Manipulating History

C. Social Distance

0 条评论