首页 > 其他 > 详细

hdu--4497--数论

时间:2014-11-09 17:59:50      阅读:234      评论:0      收藏:0      [点我收藏+]

原谅我的渣渣数学...

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

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

里面描述的很详细了

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

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

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

bubuko.com,布布扣
 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

 

hdu--4497--数论

原文:http://www.cnblogs.com/radical/p/4085307.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!