hdu--4497--数论

原谅我的渣渣数学...

发现自己都不能原谅自己...

这题 参考了   http://blog.csdn.net/a601025382s/article/details/12109307的报告

里面描述的很详细了

除了这个方法 还有一种 就是  2*3 + (num-1) * 6 = num * 6

因为 指数包含2个0 或者2个a0的排列各自只有3种

那么 另外就是C1(num-1)了 又是可以自由排列的 就是A33了

 1 #include <iostream>
 2 using namespace std;
 3 
 4 int solve( int x )
 5 {
 6     int ans = 1 , num;
 7     for( int i = 2 ; i<=x ; i++ )
 8     {
 9         if( x%i==0 )
10         {
11             num = 0;
12             while( x%i==0 )
13             {
14                 x /= i;
15                 ++ num;
16             }
17             ans *= ( num*6 );
18         }
19     }
20     if( x>1 )
21         ans *= 6;
22     return ans;
23 }
24 
25 int main()
26 {
27     cin.sync_with_stdio(false);
28     int t , G , L , k , ans;
29      cin >> t;
30     while( t-- )
31     {
32         cin >> G >> L;
33         if( L%G )
34             cout << 0 << endl;
35         else
36         {
37             k = L / G;
38             ans = solve( k );
39             cout << ans << endl;
40         }
41     }
42     return 0;
43 }
View Code
just follow your heart
原文地址:https://www.cnblogs.com/radical/p/4085307.html