제출 #811770

#제출 시각아이디문제언어결과실행 시간메모리
811770exodus_은행 (IZhO14_bank)C++14
19 / 100
67 ms300 KiB
#include<bits/stdc++.h> using namespace std; int main() { int N,M; int pip[21]; cin >> N >> M; vector<int>vek(M); for(int i=1; i<=N; i++) { cin >> pip[i]; } for(int i=0; i<M; i++) { cin >> vek[i]; } bool ada=false; for(int mask=0; mask<(1<<M); mask++) { int sum = 0; for(int i=0; i<M; i++) { if((mask>>i)&1==true) sum+=vek[i]; } if(sum==pip[1]) { ada=true; break; } } if(ada) cout << "YES"; else cout << "NO"; return 0; }

컴파일 시 표준 에러 (stderr) 메시지

bank.cpp: In function 'int main()':
bank.cpp:18:27: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
   18 |             if((mask>>i)&1==true) sum+=vek[i];
      |                          ~^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...