Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
436122 任晨熙 【C6-7】加勒比海盗船 C++ 编译错误 0 0 MS 0 KB 333 2026-04-11 19:20:22

Tests(0/0):


#include<bits/stdc++.h> using namespace std; int n,a[10086],m,c,s; int main(){ cin>>m; for(int i=1;i<=m;i++){ s=0; cin>>c>>n; for(int j=1;j<=n;j++){ cin>>a[j]; } sort(a+1,a+n+1); for(int k=1;j>0;k++){ c-=a[k]; s++; if(k==n){ break; } } if(s==n{ cout<<s; }else{ cout<<s-1<<endl; } } return 0; }


测评信息: