http://www.cnblogs.com/AOQNRMGYXLMV/p/4934747.html #include<iostream> #include<cstdio> #include<algorithm> using namespace std; ; const int inf=0x3f3f3f3f; int a[maxn]; int b[maxn]; ,,,,,,,,,}; int Solve(int t) { ; ;i>=;i--) { ||i==)…
题目链接 题目大意:给你n个物品,第iii个物品价值aia_iai,询问q次,问你能不能凑出价值为qiq_iqi的物品. 小贪心吧.从大到小找,能拿就拿就行了. #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mp make_pair #define pb push_back using namespace std; LL gcd(LL a,LL b){retur…
Polycarp has n coins, the value of the i-th coin is ai. It is guaranteed that all the values are integer powers of 2 (i.e. ai=2d for some non-negative integer number d). Polycarp wants to know answers on q queries. The j-th query is described as inte…