SPOJ
lzhf01
这个作者很懒,什么都没留下…
展开
-
Life, the Universe, and Everything
此题很水,只是第一次看到这个题目的时候有点弄不懂题意,试了一下,才发现只要遇到42就停止输入,而不是继续读入而不处理。 1. Life, the Universe, and Everything Problem code: TEST Your program is to use the brute-force approach in order to find the Answer...2011-06-03 17:38:02 · 129 阅读 · 0 评论 -
SPOJ Prime Generator
SPOJ Prime Generator 题目意思:给定两个正整数m,n,(1=1; } return res; } //判断n是否是合数,如果是则返回true,否则false /*bool witness(lld a,lld n) {//a^(n-1)=1 (mod n) lld u=n-1; lld t=0; while((...2011-06-04 19:15:39 · 114 阅读 · 0 评论 -
5. The Next Palindrome
[size=large][align=center]The Next Palindrome[/align][/size] 题目:A positive integer is called a palindrome if its representation in the decimal system is the same when read fr...2011-06-04 21:33:18 · 97 阅读 · 0 评论 -
11. Factorial
[align=center][size=large]Factorial[/size][/align] 这个题目已经做过N多遍了,在各大OJ上都有。 题目大意:给定一个正整数n,求n!未尾有多少个0。 算法分析:我们很容易发现阶乘未尾的0是由5产生的,即n!中有多少个5就有多少个0。从而问题就转化为求n!中分解质因数后5的系数。我们对其进行分类计数,首先求是5的倍数...2011-06-05 10:39:21 · 129 阅读 · 0 评论