Test instructions: There are 50 25 10 5 1 coins with a total of up to 100 inputs n output How many representations are there?
Sample Input
11
26
Sample Output
4
13
1# include <iostream>2# include <cstdio>3# include <cstring>4# include <algorithm>5# include <string>6# include <cmath>7# include <queue>8# include <list>9# define LLLong LongTen using namespacestd; One A intc1[ -][ the],c2[ -][ the]; - intans[ -] ; - intw[6]={0,1,5,Ten, -, -}; the - voidInit () { -memset (C1,0,sizeof(C1)); -memset (C2,0,sizeof(C2)); +c1[0][0]=1; - for(intI=1; i<=5; i++) + { A for(intj=0; j<= -; j + +) at for(intk=0; j+k*w[i]<= -; k++) - for(intp=0; k+p<= -;p + +) -c2[j+k*w[i]][p+k]+=C1[j][p]; - - for(intj=0; j<= -; j + +) - for(intp=0;p <= -;p + +) in { -c1[j][p]=C2[j][p]; toc2[j][p]=0; + } - } the for(intI=1; i<= -; i++) * for(intj=0; j<= -; j + +) $ANS[I]+=C1[I][J];//C1[11][3] says the scheme is made up of 3 coins, 11.Panax Notoginsengans[0]=1; - } the + intMain () A { the + intN; - Init (); $ while(~SCANF ("%d",&N)) $ { -printf"%d\n", Ans[n]); - } the return 0; -}
View Code
HDU 2069 1 5 10 25 50 These kinds of coins altogether 100 (female function)