[1574.] X- factor improving chain
(File the IO): INPUT: factor.in Output: factor.out
Time limit: 1000 MS space constraints: 131072 KB
Thinking:
A look at the subject, ignorant forced face; look range, two face ignorant force; Revisited subject, ignorant 3 faces force;
(Roh = Д =) Bruno ┻━┻
( Ignorant ignorant to force to force the tree fruit, tree ignorant to force you and me ) into the topic:
This question of violence enumeration Well, just know that the number of non-repetition factor is equivalent to chain-wide arrangement on the line ( feel good to write water ah )
CODE:
#include<iostream> #include<cstdio> #include<algorithm> using namespace std; int n,tot=0; long long ans=0; int a[31]; void chazhao(int x) { for(int i=2;i<=x;i++) { if((x%i)==0) { a[tot]=i; tot++; return chazhao(x/i); } } } int main() { freopen("factor.in","r",stdin); freopen("factor.out","w",stdout); cin>>n; chazhao(n); do { ans++; } while (next_permutation(a,a+tot)); cout<<tot<<" "<<ans; return 0; }