제출 #1257902

#제출 시각아이디문제언어결과실행 시간메모리
1257902alizhanKnapsack (NOI18_knapsack)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using ll = long long; using namespace std; const int mod = 1000000007; const int N = (int)1e4 + 7; #define endl '\n' #define skip continue #define uno first #define duo second #define YES cout<<"YES"<<'\n' #define NO cout<<"NO"<<'\n' #define GO while(tt--) #define ins insert #define pb push_back #define all(x) x.begin(), x.end() #define forest signed #define Kaldun cin.tie(0)->sync_with_stdio(0) #define int long long int bp(int a, int n) { if(n == 0) return 1; if(n % 2 == 1) return (bp(a, n-1) * 1LL * a) % mod; long long b = bp(a, n/2); return (b * b) % mod; } signed main() { //freopen("snakes.in", "r", stdin); //freopen("snakes.out", "w", stdout); Kaldun; int S,n; cin>>S>>n; for(int i=1;i<=q;i++){ int v,w,k; cin>>v>>w>>k; int cnt=min(s/w,k); cout<<v*cnt; } }

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

knapsack.cpp: In function 'int main()':
knapsack.cpp:32:20: error: 'q' was not declared in this scope
   32 |     for(int i=1;i<=q;i++){
      |                    ^
knapsack.cpp:35:21: error: 's' was not declared in this scope
   35 |         int cnt=min(s/w,k);
      |                     ^