GCD&&素筛&&快速幂
iFLY-D
一只小菜鸡飞来 FLY
展开
-
HDU1061 FLY
HDU1061Problem DescriptionGiven 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 wh...原创 2020-03-24 18:28:47 · 154 阅读 · 0 评论 -
HDU2035 FLY
HDU2035Problem Description求A^B的最后三位数表示的整数。说明:A^B的含义是“A的B次方”Input输入数据包含多个测试实例,每个实例占一行,由两个正整数A和B组成(1<=A,B<=10000),如果A=0, B=0,则表示输入数据的结束,不做处理。Output对于每个测试实例,请输出A^B的最后三位表示的整数,每个输出占一行。Sample ...原创 2020-03-24 17:11:12 · 199 阅读 · 3 评论 -
HDU5363 FLY
HDU5363Problem Descriptionsoda has a set S with n integers {1,2,…,n}. A set is called key set if the sum of integers in the set is an even number. He wants to know how many nonempty subsets of S are...原创 2020-03-24 17:00:00 · 151 阅读 · 0 评论 -
HDU4548 FLY
Problem Description小明对数的研究比较热爱,一谈到数,脑子里就涌现出好多数的问题,今天,小明想考考你对素数的认识。 问题是这样的:一个十进制数,如果是素数,而且它的各位数字和也是素数,则称之为“美素数”,如29,本身是素数,而且2+9 = 11也是素数,所以它是美素数。 给定一个区间,你能计算出这个区间内有多少个美素数吗?Input第一行输入一个正整数T,表示总共有...原创 2020-03-24 15:09:18 · 238 阅读 · 0 评论 -
HDU2098 FLY
Problem Description把一个偶数拆成两个不同素数的和,有几种拆法呢?Input输入包含一些正的偶数,其值不会超过10000,个数不会超过500,若遇0,则结束。Output对应每个偶数,输出其拆成不同素数的个数,每个结果占一行。Sample Input30260Sample Output32#include <cstdio>#include ...原创 2020-01-31 18:15:28 · 195 阅读 · 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 · 129 阅读 · 0 评论 -
HDU1108 FLY
Problem Description给定两个正整数,计算这两个数的最小公倍数。Input输入包含多组测试数据,每组只有一行,包括两个不大于1000的正整数.Output对于每个测试用例,给出这两个数的最小公倍数,每个实例输出一行。Sample Input10 14Sample Output70#include <cstdio>#include <cstri...原创 2020-01-31 17:15:35 · 205 阅读 · 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 · 229 阅读 · 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 · 139 阅读 · 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 · 278 阅读 · 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 · 148 阅读 · 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 · 211 阅读 · 0 评论