- 博客(52)
- 收藏
- 关注
原创 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 631
原创 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 268
原创 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 238
原创 HDU 1286 找新朋友
Description新年快到了,“猪头帮协会”准备搞一个聚会,已经知道现有会员N人,把会员从1到N编号,其中会长的号码是N号,凡是和会长是老朋友的,那么该会员的号码肯定和N有大于1的公约数,否则都是新朋友,现在会长想知道究竟有几个新朋友?请你编程序帮会长计算出来。Input第一行是测试数据的组数CN(Case number,1Output
2016-09-29 17:39:25 300
原创 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 277
原创 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 366
原创 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 330
原创 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 411
原创 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 298
原创 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 416
原创 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 349
原创 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 477
原创 POJ 3697 USTC campus network
DescriptionUSTC campus network is a huge network. There is a bi-directional link between every pair of computers in the network. One of the computers is the BBS server, which is so popular that
2016-09-20 14:59:58 309
原创 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 265
原创 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 319
原创 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 200
原创 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 257
原创 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 249
原创 PAT (Top Level) Practise 1012 Greedy Snake (35)
1012. Greedy Snake (35)时间限制1000 ms内存限制65536 kB代码长度限制8000 B判题程序Standard作者LIU, RujiaHave you ever played the game "Greedy Snake"
2016-09-12 21:51:40 1206
原创 PAT (Advanced Level) Practise 1119 Pre- and Post-order Traversals (30)
1119. Pre- and Post-order Traversals (30)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Special作者CHEN, YueSuppose that all the keys in
2016-09-12 20:17:43 1319 6
原创 PAT (Advanced Level) Practise 1118 Birds in Forest (25)
1118. Birds in Forest (25)时间限制150 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueSome scientists took pictures of thousands
2016-09-12 20:16:03 691
原创 PAT (Advanced Level) Practise 1117 Eddington Number(25)
1117. Eddington Number(25)时间限制250 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueBritish astronomer Eddington liked to ride
2016-09-12 20:14:33 551 1
原创 PAT (Advanced Level) Practise 1116 Come on! Let's C (20)
1116. Come on! Let's C (20)时间限制200 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, Yue"Let's C" is a popular and fun programmin
2016-09-12 20:11:48 659 2
原创 HDU 5874 Friends and Enemies
Problem DescriptionOn an isolated island, lived some dwarves. A king (not a dwarf) ruled the island and the seas nearby, there are abundant cobblestones of varying colors on the island. Every two
2016-09-11 21:54:28 453
原创 HDU 5876 Sparse Graph
Problem DescriptionIn graph theory, the complement of a graph G is a graph H on the same vertices such that two distinct vertices of H are adjacent if and only if they are not adjacent i
2016-09-11 21:47:11 346
原创 HDU 5869 Different GCD Subarray Query
Problem DescriptionThis is a simple problem. The teacher gives Bob a list of problems about GCD (Greatest Common Divisor). After studying some of them, Bob thinks that GCD is so interesting. One d
2016-09-11 21:43:53 347
原创 HDU 5877 Weak Pair
Problem DescriptionYou are given a rooted tree of N nodes, labeled from 1 to N. To the ith node a non-negative value ai is assigned.An ordered pair of nodes (u,v) is said to be weak
2016-09-11 21:34:50 468
原创 HDU 5875 Function
Problem DescriptionThe shorter, the simpler. With this problem, you should be convinced of this truth. You are given an array A of N postive integers, and M queries in the form (l,r).
2016-09-11 20:51:13 614
原创 HDU 5320 Fan Li
DescriptionFan Li (范蠡) was an ancient Chinese advisor in the state of Yue in the Spring and Autumn period. He is a successful militarist and a successful business man. He is one of the main charac
2016-09-11 20:33:42 456
原创 CSU 1807 最长上升子序列~
[Submit][Status][Web Board]DescriptionBobo 在 ICPCCamp 学会了解决最长上升子序列问题后得到了一个长度为 n 的数列 p1,p2,…,pn.Bobo 想用 1,2,…,n 来替换其中值为 0 的元素,使得 p1,p2,…,pn 互不相同(即 p1,p2,…,pn 是 {1,2,…,n} 的排列)。现在 Bobo
2016-09-06 12:19:10 881
原创 CSU 1806 Toll
Description In ICPCCamp, there are n cities and m unidirectional roads between cities. The i-th road goes from the ai-th city to the bi-th city. For each pair of cities u and v, there is at most
2016-09-05 19:52:38 600
原创 CSU 1813 盖房子
DescriptionBobo 在 ICPCCamp 买了一块 n×m 的土地,其中有些格子是障碍。他想选择两个矩形区域,建造两座房子。 很明显,用于盖房子的区域不能包含障碍。同时,两个区域不能相交(但是可以相邻)。Bobo 想知道所有可能不同方案的数量除以 (109+7) 的余数。Input输入包含不超过 10 组数据。每组数据的第一行包含两个整数 n,m
2016-09-05 18:37:03 890
原创 CSU 1811 Tree Intersection
DescriptionBobo has a tree with n vertices numbered by 1,2,…,n and (n-1) edges. The i-th vertex has color ci, and the i-th edge connects vertices ai and bi.Let C(x,y) denotes the set of colors
2016-09-04 15:18:28 1066 2
原创 CSU 1808 地铁
Description Bobo 居住在大城市 ICPCCamp。ICPCCamp 有 n 个地铁站,用 1,2,…,n 编号。 m 段双向的地铁线路连接 n 个地铁站,其中第 i 段地铁属于 ci 号线,位于站 ai,bi 之间,往返均需要花费 ti 分钟(即从 ai 到 bi 需要 ti 分钟,从 bi 到 ai 也需要 ti分钟)。众所周知,换乘线路很麻烦。如
2016-09-04 14:14:52 759
原创 CSU 1812 三角形和矩形
DescriptionBobo 有一个三角形和一个矩形,他想求他们交的面积。具体地,三角形和矩形由 8 个整数 x1,y1,x2,y2,x3,y3,x4,y4 描述。 表示三角形的顶点坐标是 (x1,y1),(x1,y2),(x2,y1), 矩形的顶点坐标是 (x3,y3),(x3,y4),(x4,y4),(x4,y3).Input输入包含不超过 30000
2016-09-03 22:18:26 759
原创 CSU 1810 Reverse
DescriptionBobo has a n digits decimal number D=d1 d2…dn (It may have leading zeros).Let R(i,j) denotes number D with digits between the i-th position and j-th position reversed. That is, R(i,
2016-09-03 22:14:22 524
原创 CSU 1809 Parenthesis
DescriptionBobo has a balanced parenthesis sequence P=p1 p2…pn of length n and q questions.The i-th question is whether P remains balanced after pai and pbi swapped. Note that questions are
2016-09-03 22:01:08 726
原创 CSU 1804 有向无环图
DescriptionBobo 有一个 n 个点,m 条边的有向无环图(即对于任意点 v,不存在从点 v 开始、点 v 结束的路径)。为了方便,点用 1,2,…,n 编号。 设 count(x,y) 表示点 x 到点 y 不同的路径数量(规定 count(x,x)=0),Bobo 想知道除以 (109+7) 的余数。其中,ai,bj 是给定的数列。I
2016-09-03 21:51:43 1056
原创 CSU 1803 2016
Description 给出正整数 n 和 m,统计满足以下条件的正整数对 (a,b) 的数量:1. 1≤a≤n,1≤b≤m;2. a×b 是 2016 的倍数。Input输入包含不超过 30 组数据。每组数据包含两个整数 n,m
2016-09-03 21:48:25 478
原创 HDU 5381 The sum of gcd
DescriptionYou have an array ,the length of is Let InputThere are multiple test cases. The first line of input contains an integer T, indicating the number of test cases. Fo
2016-09-02 18:11:14 517
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人