随笔分类 -  ACM-数论

摘要:题意:n的阶乘后面有多少个0?6的阶乘 = 1*2*3*4*5*6 = 720,720后面有1个0。Input一个数N(1> n; ll ans=0; ll tmp=5; while(tmp<=n){ ans+=(n/tmp); tmp*=5; }... 阅读全文
posted @ 2015-04-09 13:35 fish7 阅读(311) 评论(0) 推荐(0)
摘要:Problem DescriptionGiven a sequence 1,2,3,......N, your job is to calculate all the possible sub-sequences that the sum of the sub-sequence is M.Input... 阅读全文
posted @ 2014-12-02 18:23 fish7 阅读(129) 评论(0) 推荐(0)
摘要:题意:给一个正整数N,找最小的M,使得N可以整除M,且N/M是质数。数据范围:There are multiple test cases (no more than 1,000). Each case contains only one positive integer N.N≤1,000,000,... 阅读全文
posted @ 2014-11-22 23:04 fish7 阅读(145) 评论(0) 推荐(0)
摘要:题意:给你两个数:X和Y 。输出它们的第K大公约数。若不存在输出 -1数据范围:1 #include #include #include #include #include #include #include #include #include using namespace std;int con... 阅读全文
posted @ 2014-09-20 19:33 fish7 阅读(127) 评论(0) 推荐(0)