#include<iostream>
using namespace std;
int tab[20];
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, m;
cin>>n>>m;
int N;
cin>>N;
for(int i=0; i<m; i++){
cin>>tab[i];
}
for(int maska = 0; maska < (1<<(m+1)); maska++){
int sumka = 0;
for(int i=0; i<m; i++){
sumka += ((maska>>i)&1) * tab[i];
}
if(sumka == N){
cout<<"YES";
return 0;
}
}
cout<<"NO";
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |