算法题目
iFLY-D
一只小菜鸡飞来 FLY
展开
-
HDU2098 FLY
Problem Description把一个偶数拆成两个不同素数的和,有几种拆法呢?Input输入包含一些正的偶数,其值不会超过10000,个数不会超过500,若遇0,则结束。Output对应每个偶数,输出其拆成不同素数的个数,每个结果占一行。Sample Input30260Sample Output32#include <cstdio>#include ...原创 2020-01-31 18:15:28 · 180 阅读 · 0 评论 -
HDU 2012 FLY
Problem Description对于表达式n^2+n+41,当n在(x,y)范围内取整数值时(包括x,y)(-39<=x<y<=50),判定该表达式的值是否都为素数。Input输入数据有多组,每组占一行,由两个整数x,y组成,当x=0,y=0时,表示输入结束,该行不做处理。Output对于每个给定范围内的取值,如果表达式的值都为素数,则输出"OK",否则请输出“S...原创 2020-01-31 18:06:56 · 112 阅读 · 0 评论 -
HDU1108 FLY
Problem Description给定两个正整数,计算这两个数的最小公倍数。Input输入包含多组测试数据,每组只有一行,包括两个不大于1000的正整数.Output对于每个测试用例,给出这两个数的最小公倍数,每个实例输出一行。Sample Input10 14Sample Output70#include <cstdio>#include <cstri...原创 2020-01-31 17:15:35 · 189 阅读 · 0 评论 -
HDU2504 FLY
Problem Description有三个正整数a,b,c(0<a,b,c<10^6),其中c不等于b。若a和c的最大公约数为b,现已知a和b,求满足条件的最小的c。Input第一行输入一个n,表示有n组测试数据,接下来的n行,每行输入两个正整数a,b。Output输出对应的c,每组测试数据占一行。Sample Input26 212 4Sample Output...原创 2020-01-31 16:54:40 · 198 阅读 · 0 评论 -
HDU1722 FLY
Problem Description一次生日Party可能有p人或者q人参加,现准备有一个大蛋糕.问最少要将蛋糕切成多少块(每块大小不一定相等),才能使p人或者q人出席的任何一种情况,都能平均将蛋糕分食.Input每行有两个数p和q.Output输出最少要将蛋糕切成多少块.Sample Input2 3Sample Output4Hint将蛋糕切成大小分别为1/3,1/3,...原创 2020-01-28 13:21:00 · 122 阅读 · 0 评论 -
HDU1222 FLY
Problem DescriptionThere 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 ...原创 2020-01-28 12:59:12 · 252 阅读 · 0 评论 -
POJ1995 FLY
DescriptionPeople are different. Some secretly read magazines full of interesting girls’ pictures, others create an A-bomb in their cellar, others like using Windows, and some like difficult mathemat...原创 2020-01-28 12:31:10 · 199 阅读 · 0 评论 -
POJ 3641 FLY
DescriptionFermat’s theorem states that for any prime number p and for any integer a > 1, ap = a (mod p). That is, if we raise a to the pth power and divide by p, the remainder is a. Some (but not...原创 2020-01-28 12:27:37 · 131 阅读 · 0 评论 -
HDU2098 FLY
审题很重要Problem Description把一个偶数拆成两个不同素数的和,有几种拆法呢?Input输入包含一些正的偶数,其值不会超过10000,个数不会超过500,若遇0,则结束。Output对应每个偶数,输出其拆成不同素数的个数,每个结果占一行。Sample Input30260Sample Output32Source2007省赛集训队练习赛(2)Reco...原创 2019-09-06 12:11:58 · 93 阅读 · 0 评论 -
HDU2012 FLY
Problem Description对于表达式n^2+n+41,当n在(x,y)范围内取整数值时(包括x,y)(-39<=x<y<=50),判定该表达式的值是否都为素数。Input输入数据有多组,每组占一行,由两个整数x,y组成,当x=0,y=0时,表示输入结束,该行不做处理。Output对于每个给定范围内的取值,如果表达式的值都为素数,则输出"OK",否则请输出“S...原创 2019-09-06 11:13:24 · 94 阅读 · 0 评论 -
HDU 1288 最小公倍数 FLY
Problem Description给定两个正整数,计算这两个数的最小公倍数。Input输入包含多组测试数据,每组只有一行,包括两个不大于1000的正整数.Output对于每个测试用例,给出这两个数的最小公倍数,每个实例输出一行。Sample Input10 14Sample Output70SourcePOJRecommendEddy#include <cst...原创 2019-09-05 15:03:01 · 184 阅读 · 0 评论 -
HDU1222 详解 FLY
Wolf and RabbitThere 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 g...原创 2019-09-05 09:06:41 · 204 阅读 · 0 评论 -
poj1995 FLY
DescriptionPeople are different. Some secretly read magazines full of interesting girls’ pictures, others create an A-bomb in their cellar, others like using Windows, and some like difficult mathemat...原创 2019-09-04 13:13:34 · 170 阅读 · 0 评论 -
HDU2035人见人爱A^B FLY
[HDU2035人见人爱A^B链接简单的次方类算法(http://acm.hdu.edu.cn/showproblem.php?pid=2035)求A^B的最后三位数表示的整数。 说明:A^B的含义是“A的B次方”Input输入数据包含多个测试实例,每个实例占一行,由两个正整数A和B组成(1<=A,B<=10000),如果A=0, B=0,则表示输入数据的结束,不做处理。...原创 2019-08-13 10:45:50 · 134 阅读 · 0 评论 -
HDU1108最小公倍数 FLY
**hdu1108链接给定两个正整数,计算这两个数的最小公倍数**。Input输入包含多组测试数据,每组只有一行,包括两个不大于1000的正整数.**Output对于每个测试用例,给出这两个数的最小公倍数,每个实例输出一行。Sample Input10 14Sample Output``70#include <stdio.h>int main(){ ...原创 2019-08-13 10:22:38 · 133 阅读 · 0 评论 -
HDU1258 FLY
Time limit1000 msMemory limit32768 kB有N个比赛队(1<=N<=500),编号依次为1,2,3,。。。。,N进行比赛,比赛结束后,裁判委员会要将所有参赛队伍从前往后依次排名,但现在裁判委员会不能直接获得每个队的比赛成绩,只知道每场比赛的结果,即P1赢P2,用P1,P2表示,排名时P1在P2之前。现在请你编程序确定排名。Input输入有若干...转载 2019-08-07 17:18:36 · 208 阅读 · 0 评论 -
POJ1383 两次搜索求最长 FLY
原题链接poj1383链接DescriptionThe northern part of the Pyramid contains a very large and complicated labyrinth. The labyrinth is divided into square blocks, each of them either filled by rock, or free. T...原创 2019-08-18 17:03:25 · 276 阅读 · 0 评论 -
HDU1280前m大的数 FLY
[题目链接](http://acm.hdu.edu.cn/showproblem.php?pid=1280)Problem Description还记得Gardon给小希布置的那个作业么?(上次比赛的1005)其实小希已经找回了原来的那张数表,现在她想确认一下她的答案是否正确,但是整个的答案是很庞大的表,小希只想让你把答案中最大的M个数告诉她就可以了。给定一个包含N(N<=3000...原创 2019-08-13 17:13:37 · 132 阅读 · 0 评论 -
HDU1757 FLY
HDU1757链接(https://vjudge.net/problem/22253/origin)**Lele now is thinking about a simple function f(x).If x < 10 f(x) = x.If x >= 10 f(x) = a0 * f(x-1) + a1 * f(x-2) + a2 * f(x-3) + …… + a9 *...原创 2019-08-04 16:13:06 · 117 阅读 · 0 评论