----欧拉函数
文章平均质量分 77
_Occult_
物語が始まった
展开
-
HDU 5780 gcd
Problem DescriptionLittle White learned the greatest common divisor, so she plan to solve a problem: given x, n,query ∑gcd(xa−1,xb−1) (1≤a,b≤n) InputThe first line of input is an原创 2016-07-31 13:05:16 · 671 阅读 · 0 评论 -
FZU 1759 Super A^B mod C
DescriptionGiven A,B,C, You should quickly calculate the result of A^B mod C. (1InputThere are multiply testcases. Each testcase, there is one line contains three integers A, B a原创 2016-09-22 16:09:14 · 440 阅读 · 0 评论 -
HDU 5868 Different Circle Permutation
DescriptionYou may not know this but it's a fact that Xinghai Square is Asia's largest city square. It is located in Dalian and, of course, a landmark of the city. It's an ideal place for outing a原创 2016-09-29 17:46:47 · 668 阅读 · 0 评论 -
HDU 2588 GCD
DescriptionThe greatest common divisor GCD(a,b) of two positive integers a and b,sometimes written (a,b),is the largest divisor common to a and b,For example,(1,2)=1,(12,18)=6. (a,b) can be easi原创 2016-09-29 17:41:21 · 281 阅读 · 0 评论 -
HDU 1787 GCD Again
DescriptionDo you have spent some time to think and try to solve those unsolved problem after one ACM contest? No? Oh, you must do this when you want to become a "Big Cattle". Now you will fin原创 2016-09-29 17:40:12 · 256 阅读 · 0 评论 -
HDU 1286 找新朋友
Description新年快到了,“猪头帮协会”准备搞一个聚会,已经知道现有会员N人,把会员从1到N编号,其中会长的号码是N号,凡是和会长是老朋友的,那么该会员的号码肯定和N有大于1的公约数,否则都是新朋友,现在会长想知道究竟有几个新朋友?请你编程序帮会长计算出来。Input第一行是测试数据的组数CN(Case number,1Output原创 2016-09-29 17:39:25 · 319 阅读 · 0 评论 -
HDU 2824 The Euler function
DescriptionThe Euler function phi is an important kind of function in number theory, (n) represents the amount of the numbers which are smaller than n and coprime to n, and this function has a lot原创 2016-09-29 17:34:25 · 399 阅读 · 0 评论 -
HDU 4335 What is N?
Description (This problem is really old&easy and any acmer who is good at math may solve it in second) As we know, math is both intangible and specific. Today you are going to solve the follo原创 2016-09-29 17:33:14 · 347 阅读 · 0 评论 -
HDU 2837 Calculation
DescriptionAssume that f(0) = 1 and 0^0=1. f(n) = (n%10)^f(n/10) for all n bigger than zero. Please calculate f(n)%m. (2 ≤ n , m ≤ 10^9, x^y means the y th power of x).InputThe first原创 2016-09-29 17:30:49 · 440 阅读 · 0 评论 -
HDU 3221 Brute-force Algorithm
DescriptionProfessor Brute is not good at algorithm design. Once he was asked to solve a path finding problem. He worked on it for several days and finally came up with the following algorithm:原创 2016-09-29 17:28:55 · 321 阅读 · 0 评论 -
POJ 3358 Period of an Infinite Binary Expansion
DescriptionLet {x} = 0.a1a2a3... be the binary representation of the fractional part of a rational number z. Suppose that {x} is periodic then, we can write{x} = 0.a1a2...ar(ar+1ar+2...ar+s)w原创 2016-09-22 15:30:08 · 361 阅读 · 0 评论 -
HYSBZ 2818 Gcd
Description给定整数N,求1数对(x,y)有多少对.Input一个整数NOutput如题Sample Input4Sample Output4Hinthint对于样例(2,2),(2,4),(3,3),(4,2)原创 2016-09-20 16:29:00 · 498 阅读 · 0 评论 -
POJ 3696 The Luckiest number
DescriptionChinese people think of '8' as the lucky digit. Bob also likes digit '8'. Moreover, Bob has his own lucky number L. Now he wants to construct his luckiest number which is the minimum原创 2016-09-16 14:09:49 · 286 阅读 · 0 评论 -
POJ 3090 Visible Lattice Points
DescriptionA lattice point (x, y) in the first quadrant (x and y are integers greater than or equal to 0), other than the origin, is visible from the origin if the line from (0, 0) to (x, y) d原创 2016-09-15 20:46:16 · 332 阅读 · 0 评论 -
POJ 2478 Farey Sequence
DescriptionThe Farey Sequence Fn for any integer n with n >= 2 is the set of irreducible rational numbers a/b with 0 F2 = {1/2} F3 = {1/3, 1/2, 2/3} F4 = {1/4, 1/3, 1/2, 2/3, 3/4} F5 = {1/原创 2016-09-15 20:33:24 · 219 阅读 · 0 评论 -
POJ 1284 Primitive Roots
DescriptionWe say that integer x, 0 i mod p) | 1 <= i <= p-1 } is equal to { 1, ..., p-1 }. For example, the consecutive powers of 3 modulo 7 are 3, 2, 6, 4, 5, 1, and thus 3 is a primitive root原创 2016-09-15 20:11:32 · 280 阅读 · 0 评论 -
POJ 2407 Relatives
DescriptionGiven n, a positive integer, how many positive integers less than n are relatively prime to n? Two integers a and b are relatively prime if there are no integers x > 1, y > 0, z > 0 suc原创 2016-09-15 19:57:20 · 269 阅读 · 0 评论 -
HDU 1695 GCD
DescriptionGiven 5 integers: a, b, c, d, k, you're to find x in a...b, y in c...d that GCD(x, y) = k. GCD(x, y) means the greatest common divisor of x and y. Since the number of choices may be ver原创 2016-09-29 17:36:58 · 293 阅读 · 0 评论