DES: give you n pieces of stone. No more than 70. Divide them into n heaps. The number of stones in each heap is a product. How many numbers are there in the question? The final result can be divided into primes or primes multiplied by 1 in addition to 1. So you can find all the primes up to 70 and then deep search.
It's hard to feel good and hard to find.
#include <stdio.h>#include<iostream>#include<Set>using namespacestd;intprime[ +] = {2,3,5,7, One, -, -, +, at, in, to,Panax Notoginseng, A, +, -, -, -, A, the, in, the};Set<Long Long>s;intp;voidDfsintXintNLong LongJi//do you want to count the number of x? What the current value is. What is the current product ?{S.insert (JI); if(Prime[x] > N)return; DFS (x+1, N, Ji);//do not take the first x primeDFS (x, n-prime[x], ji*prime[x]%p);//Take number x}intMain () {intT; CIN>>T; while(t--) { intN; CIN>> N >>p; S.clear (); DFS (0N1); cout<< s.size () <<Endl; } return 0;}L Oh, oh, K .
Spoj amr10i Recursion