Run ID Author Problem Lang Verdict Time Memory Code Length Submit Time
76703 sh25_shenpy 淘气的小明摘椰子 C++ Wrong Answer 1 MS 256 KB 480 2025-12-19 15:47:40

Tests(0/1):


#include <bits/stdc++.h> #include<algorithm> #include<functional> using namespace std; int s[1011]; int main() { int n,h,m,d=0,k=0; cin>>h; cin>>n; m=sizeof(s)/sizeof(s[0]); for(int i=0;i<m;++i){ cin>>s[i]; } sort(s,s+m,greater<int>()); for(int x:s) { d+=x; k++; if(d>=h){ cout<<k; break;}} d=0; for(int y:s){ d+=y;} if(d<h) cout<<"-1"; return 0; }


Judgement Protocol: