标签:efault otto include hid main tput mat strong ext
传送门:
http://acm.hdu.edu.cn/showproblem.php?pid=2079
Description
Input
Output
Sample Input
Sample Output
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define max_v 60 int c1[max_v]; int c2[max_v]; int main() { int t; scanf("%d",&t); while(t--) { memset(c1,0,sizeof(c1)); memset(c2,0,sizeof(c2)); c1[0]=1; int n,k; scanf("%d %d",&n,&k); int val,num; for(int i=1; i<=k; i++) { scanf("%d %d",&val,&num); for(int j=0; j<=n; j++) { for(int y=0; y*val+j<=n&&y<=num; y++) { c2[j+y*val]+=c1[j]; } } for(int j=0; j<=n; j++) { c1[j]=c2[j]; c2[j]=0; } } printf("%d\n",c1[n]); } return 0; }
标签:efault otto include hid main tput mat strong ext
原文地址:https://www.cnblogs.com/yinbiao/p/9307335.html