![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
GCD
苍山洱海胖
没有人愿意等不努力的你
展开
-
【hdu 1108】最小公倍数
最小公倍数 给定两个正整数,计算这两个数的最小公倍数。Input输入包含多组测试数据,每组只有一行,包括两个不大于1000的正整数.Output对于每个测试用例,给出这两个数的最小公倍数,每个实例输出一行。 Sample Input10 14Sample Output70代码:#includeint main(){ int原创 2017-08-07 18:21:05 · 239 阅读 · 0 评论 -
【lightoj 1214】Large Division (大数除法)
Large Division Given two integers, a and b, you should check whether a is divisible by b or not. We know that an integer a is divisible by an integer b if and only if there exists an integer原创 2017-08-21 10:35:07 · 403 阅读 · 0 评论 -
【hdu 1061】Rightmost Digit(快速幂)
Rightmost DigitTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 57745 Accepted Submission(s): 21884Problem DescriptionGiven a原创 2017-08-20 20:58:22 · 285 阅读 · 0 评论 -
【hdu 4548】美素数
美素数Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 7534 Accepted Submission(s): 2657Problem Description 小明对数的研究比较热爱,一谈到数,脑原创 2017-08-20 20:29:07 · 489 阅读 · 0 评论 -
【hdu 2012】 素数判定
点击打开链接题目:Problem Description对于表达式n^2+n+41,当n在(x,y)范围内取整数值时(包括x,y)(-39Input输入数据有多组,每组占一行,由两个整数x,y组成,当x=0,y=0时,表示输入结束,该行不做处理。Output对于每个给定范围内的取值,如果表达式的值都为素数,则输出"OK",否则请输出“So原创 2017-07-24 13:54:40 · 355 阅读 · 0 评论 -
【hdu 2504】又见GCD
又见GCD 有三个正整数a,b,c(0Input第一行输入一个n,表示有n组测试数据,接下来的n行,每行输入两个正整数a,b。 Output输出对应的c,每组测试数据占一行。 Sample Input26 212 4Sample Output48代码:#includeint main(){ long l原创 2017-08-07 18:18:04 · 212 阅读 · 0 评论 -
【hdu 1722】 Cake
点击打开链接题目:一次生日Party可能有p人或者q人参加,现准备有一个大蛋糕.问最少要将蛋糕切成多少块(每块大小不一定相等),才能使p人或者q人出席的任何一种情况,都能平均将蛋糕分食.Input每行有两个数p和q. Output输出最少要将蛋糕切成多少块. Sample Input2 3Sample Output4Hint将蛋糕原创 2017-07-24 13:33:42 · 236 阅读 · 0 评论 -
【hdu 1222】Wolf and Rabbit
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. Th原创 2017-08-07 18:12:15 · 359 阅读 · 0 评论 -
【LCM】
代码:#includeint main(){ int gcd(long long a,long long b); int t; long long a,b,c,lcm; scanf("%d",&t); while(t--) { scanf("%lld%lld",&a,&b); c=gcd(a,b); lcm=a/c*b; printf("%lld\n",lcm);原创 2017-08-08 17:40:01 · 232 阅读 · 0 评论 -
【hdu 2098】 分拆素数和
点击打开链接题目:把一个偶数拆成两个不同素数的和,有几种拆法呢?Input输入包含一些正的偶数,其值不会超过10000,个数不会超过500,若遇0,则结束。Output对应每个偶数,输出其拆成不同素数的个数,每个结果占一行。Sample Input30260Sample Output32代码#includeint mai原创 2017-07-25 23:33:53 · 262 阅读 · 0 评论