Skip to content

Instantly share code, notes, and snippets.

@enzerr
Created June 14, 2023 12:41
Show Gist options
  • Save enzerr/b42db10f5b96a00dc7e27323a588b98b to your computer and use it in GitHub Desktop.
Save enzerr/b42db10f5b96a00dc7e27323a588b98b to your computer and use it in GitHub Desktop.
#include<bits/stdc++.h>
using namespace std;
int main(){
int s; cin >> s;
int aux[3]; cin >> aux[0] >> aux[1] >> aux[2];
sort(aux, aux+3);
int ans = 0;
if(s>=aux[0]) ans=1;
if(s>=aux[0]+aux[1]) ans=2;
if(s>=aux[0]+aux[1]+aux[2]) ans=3;
cout << ans << '\n';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment