There are NUM1 1, num2 2, num3 5.
Ask them which of the smallest positive integers they cannot form
Sample's parent function (1+x) (1+x2) (1+x5+x10+x15)
The coefficient of X4 after expansion is 0
Sample Input
1 1 3
0 0 0
Sample Output
4
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[10010], c2[10010] ; - intnum[5] ; - intMain () the { - - while(SCANF (" %d%d%d", &num[1], &num[2], &num[3])!=EOF) - { + if(num[1] ==0&& num[2] ==0&& num[3] ==0) - Break ; + intMax = num[1]*1+num[2]*2+num[3]*5; A at for(intI=0; i<=max; ++i) - { -C1[i] =0; -C2[i] =0; - } - for(intI=0; i<=num[1]; ++i) inC1[i] =1; - for(intI=0; i<=num[1]; ++i) to for(intj=0; j<=num[2]*2; j+=2) +C2[j+i] + =C1[i]; - for(intI=0; i<=num[2]*2+num[1]*1; ++i) the { *C1[i] =C2[i]; $C2[i] =0;Panax Notoginseng } - the for(intI=0; i<=num[1]*1+num[2]*2; ++i) + for(intj=0; j<=num[3]*5; j+=5) AC2[j+i] + =C1[i]; the for(intI=0; i<=num[2]*2+num[1]*1+num[3]*5; ++i) + { -C1[i] =C2[i]; $C2[i] =0; $ } - inti; - the for(i=0; i<=max; ++i) - if(C1[i] = =0)Wuyi { theprintf"%d\n", i); - Break; Wu } - if(i = = max+1) Aboutprintf"%d\n", i); $ } - return 0; -}
View Code
HDU 1085 has NUM1 1, num2 2, num3 5 (female function)