
GCD&LCM&素数打表&快速幂专题
sping-
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
A - Wolf and Rabbit
点击打开链接 There is a hill with n holes around. The holes are signed from 0 to n-1. A rabbit must hide in one of the holes. A wolf searches the rabbit in anticlockwise order. The fi原创 2017-07-28 09:36:46 · 223 阅读 · 0 评论 -
B - Cake
点击打开链接 一次生日Party可能有p人或者q人参加,现准备有一个大蛋糕.问最少要将蛋糕切成多少块(每块大小不一定相等),才能使p人或者q人出席的任何一种情况,都能平均将蛋糕分食. Input每行有两个数p和q. Output输出最少要将蛋糕切成多少块. Sample Input 2 3 Sample Output 4原创 2017-07-28 09:52:02 · 194 阅读 · 0 评论 -
C - 又见GCD
点击打开链接 有三个正整数a,b,c(0 Input第一行输入一个n,表示有n组测试数据,接下来的n行,每行输入两个正整数a,b。 Output输出对应的c,每组测试数据占一行。 Sample Input 2 6 2 12 4 Sample Output 4 8 代码: #include int gcd(int a原创 2017-07-28 10:01:33 · 205 阅读 · 0 评论 -
D - 最小公倍数
点击打开链接 给定两个正整数,计算这两个数的最小公倍数。 Input输入包含多组测试数据,每组只有一行,包括两个不大于1000的正整数. Output对于每个测试用例,给出这两个数的最小公倍数,每个实例输出一行。 Sample Input 10 14 Sample Output 70原创 2017-07-28 10:03:54 · 158 阅读 · 0 评论 -
E - 素数判定
点击打开链接 对于表达式n^2+n+41,当n在(x,y)范围内取整数值时(包括x,y)(-39 Input输入数据有多组,每组占一行,由两个整数x,y组成,当x=0,y=0时,表示输入结束,该行不做处理。 Output对于每个给定范围内的取值,如果表达式的值都为素数,则输出"OK",否则请输出“Sorry”,每组输出占一行。 Sample Input 0 1原创 2017-07-28 10:07:59 · 228 阅读 · 0 评论 -
F - 分拆素数和
点击打开链接 把一个偶数拆成两个不同素数的和,有几种拆法呢? Input输入包含一些正的偶数,其值不会超过10000,个数不会超过500,若遇0,则结束。 Output对应每个偶数,输出其拆成不同素数的个数,每个结果占一行。 Sample Input 30 26 0 Sample Output 3 2 分析:先用素数打表法把素数找出来,之后两原创 2017-07-28 10:14:59 · 198 阅读 · 0 评论 -
I - Rightmost Digit
点击打开链接 Given a positive integer N, you should output the most right digit of N^N. InputThe input contains several test cases. The first line of the input is a single integer T which i原创 2017-07-28 10:28:17 · 177 阅读 · 0 评论