제출 #1121511

#제출 시각아이디문제언어결과실행 시간메모리
1121511vjudge1Ice Hockey World Championship (CEOI15_bobek)C++14
40 / 100
63 ms504 KiB
//#pragma GCC optimize ("O1") #include <bits/stdc++.h> using namespace std; #define endl '\n' #define pb push_back #define F first #define S second #define ll long long #define int ll #define pii pair<int, int> #define io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) #define M_PI 3.14159265358979323846 #define all(v) v.begin(), v.end() #define pss pair<string, string> #define no cout<<"NO"<<endl; #define yes cout<<"YES"<<endl; #define imp cout<<-1<<endl; #define flu cout.flush(); #define Endl endl const int N = 300009; const int mod = 1e9+7; void solve(){ int n, k; cin>>n>>k; vector<int>a; for(int i=0; i<n; i++){ int x; cin>>x; a.pb(x); } int ans=0; for(int i=0; i<(1<<n); i++){ int cem=k, cnt=0; for(int j=0; j<n; j++){ if(i&(1<<j)){ cem-=a[j]; if(k<0){ cnt=-1; break; } } } if(cem>=0){ ans+=1; } } cout<<ans<<endl; } signed main(){ io; int t=1; //cin>>t; while(t--){ solve(); } }

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

bobek.cpp: In function 'void solve()':
bobek.cpp:37:20: warning: variable 'cnt' set but not used [-Wunused-but-set-variable]
   37 |         int cem=k, cnt=0;
      |                    ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...