最大公约数
文章平均质量分 69
w1997t
ACM:从入门到入土
展开
-
暑期集训之最大公约数问题
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 first hole he get into转载 2017-07-21 19:24:35 · 266 阅读 · 0 评论 -
暑期集训之cake
一次生日Party可能有p人或者q人参加,现准备有一个大蛋糕.问最少要将蛋糕切成多少块(每块大小不一定相等),才能使p人或者q人出席的任何一种情况,都能平均将蛋糕分食. Input每行有两个数p和q. Output输出最少要将蛋糕切成多少块. Sample Input 2 3 Sample Output 4 Hint 将蛋糕转载 2017-07-21 20:58:22 · 214 阅读 · 0 评论 -
暑期集训之又见GCD
有三个正整数a,b,c(0 Input第一行输入一个n,表示有n组测试数据,接下来的n行,每行输入两个正整数a,b。 Output输出对应的c,每组测试数据占一行。 Sample Input 2 6 2 12 4 Sample Output 4 8这道题其实是一道关于最大公约数的,数据不大正常暴力求解就能AC,虽然学长说过有数学方法,不过还是没听懂,还是暴力解出原创 2017-07-21 22:13:37 · 240 阅读 · 0 评论