Codeforces 385B. Bear and Strings
摘要:The bear has a string s = s1s2... s|s| (record |s| is the string's length), consisting of lowercase English letters. The bear wants to count the numbe
阅读全文
posted @
2017-08-28 23:35
Crutain
阅读(238)
推荐(1)
XidianOJ 1213 小V的滑板鞋
摘要:题目描述 输入 输出 摘自题解。。orz我还是太菜了 #include<bits/stdc++.h> using namespace std; typedef long long LL; #define m first #define w second const int SIZE=1e5+7; i
阅读全文
posted @
2017-08-28 17:24
Crutain
阅读(145)
推荐(0)
Codeforces 186A. Comparing Strings
摘要:Some dwarves that are finishing the StUDY (State University for Dwarven Youngsters) Bachelor courses, have been told "no genome, no degree". That mean
阅读全文
posted @
2017-08-27 14:15
Crutain
阅读(136)
推荐(0)
poj 3122 Pie
摘要:Description My birthday is coming up and traditionally I'm serving pie. Not just one pie, no, I have a number N of them, of various tastes and of vari
阅读全文
posted @
2017-08-26 16:07
Crutain
阅读(148)
推荐(0)
Codeforces 348A. Mafia
摘要:One day n friends gathered together to play "Mafia". During each round of the game some player must be the supervisor and other n - 1 people take part
阅读全文
posted @
2017-08-24 01:49
Crutain
阅读(199)
推荐(0)
Codeforces 605A. Sorting Railway Cars
摘要:An infinitely long railway has a train consisting of n cars, numbered from 1 to n (the numbers of all the cars are distinct) and positioned in arbitra
阅读全文
posted @
2017-08-24 01:07
Crutain
阅读(184)
推荐(0)
莫比乌斯二连 HDU 5212 Code & HDU 1695 GCD
摘要:莫比乌斯的模板题 都是差不多的 F(m)为gcd(i,j) = m(i∈[1,m],j∈[1,n])的个数 f(m) = ∑(m\d) F(d) 意义为gcd(i,j)为m的倍数的个数 运用莫比乌斯反演得到 F(m) = ∑(m\d)μ(d/m) * f(d) #include <iostream>
阅读全文
posted @
2017-08-23 11:33
Crutain
阅读(143)
推荐(0)
原根二连 HDU 4992 && poj 1284 Primitive Roots
摘要:原根存在的充要条件 n = 1,2,4,p^r (p为奇素数,r为任意正整数) 原根的性质 若n存在原根,则原根个数为φ(φ(n)) 若g是n的一个原根,则g^d是n的原根的充要条件为gcd(d,φ(n)) = 1 一个数的全体原根乘积模n余1 一个数的全体原根和模n余μ(n-1) #include
阅读全文
posted @
2017-08-22 21:08
Crutain
阅读(160)
推荐(0)
Codeforces 451E Devu and Flowers
摘要:Devu wants to decorate his garden with flowers. He has purchased n boxes, where the i-th box contains fi flowers. All flowers in a single box are of t
阅读全文
posted @
2017-08-22 13:39
Crutain
阅读(169)
推荐(0)
Codeforces 235A. LCM Challenge
摘要:Some days ago, I learned the concept of LCM (least common multiple). I've played with it for several times and I want to make a big number with it. Bu
阅读全文
posted @
2017-08-21 16:49
Crutain
阅读(224)
推荐(0)
离散对数二连 poj 2417 Discrete Logging & HDU 2815 Mod Tree
摘要:题目就不贴了。都是一样的套路求解a^x % c = b的最小x 注意HDU的题目很坑,有b比c大和题目中输出信息为全角引号的坑 下面贴的是HDU的版本,poj的改一下a,b,c顺序和输出就好 #include <iostream> #include <cstring> #include <algor
阅读全文
posted @
2017-08-21 13:55
Crutain
阅读(148)
推荐(0)
HDU 5634 Rikka with Phi
摘要:Problem Description Rikka and Yuta are interested in Phi function (which is known as Euler's totient function).Yuta gives Rikka an array A[1..n] of po
阅读全文
posted @
2017-08-20 14:32
Crutain
阅读(181)
推荐(0)
HDU 2048 神、上帝以及老天爷
摘要:题目描述 协会活动为了活跃气氛,组织者举行了一个别开生面、奖品丰厚的抽奖活动,这个活动的具体要求是这样的:首先,所有参加晚会的人员都将一张写有自己名字的字条放入抽奖箱中;然后,待所有字条加入完毕,每人从箱中取一个字条;最后,如果取得的字条上写的就是自己的名字,那么“恭喜你,中奖了!” 大家可以想象一
阅读全文
posted @
2017-08-18 16:16
Crutain
阅读(150)
推荐(0)
HDU 2643 Rank
摘要:Problem Description Recently in Teddy's hometown there is a competition named "Cow Year Blow Cow".N competitors had took part in this competition.The
阅读全文
posted @
2017-08-18 15:56
Crutain
阅读(165)
推荐(0)
HDU 3625 Examining the Rooms
摘要:Problem Description A murder happened in the hotel. As the best detective in the town, you should examine all the N rooms of the hotel immediately. Ho
阅读全文
posted @
2017-08-18 14:50
Crutain
阅读(110)
推荐(0)
poj 3090 Visible Lattice Points
摘要:Description A 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
阅读全文
posted @
2017-08-17 23:54
Crutain
阅读(136)
推荐(0)
bzoj 3884: 上帝与集合的正确用法
摘要:Description 根据一些书上的记载,上帝的一次失败的创世经历是这样的: 第一天, 上帝创造了一个世界的基本元素,称做“元”。 第二天, 上帝创造了一个新的元素,称作“α”。“α”被定义为“元”构成的集合。容易发现,一共有两种不同的“α”。 第三天, 上帝又创造了一个新的元素,称作“β”。“β
阅读全文
posted @
2017-08-17 23:36
Crutain
阅读(171)
推荐(0)
HDU 4704 Sum
摘要:Problem Description Sample Input 2 2 Sample Output 2 Hint 1. For N = 2, S(1) = S(2) = 1. 2. The input file consists of multiple test cases. 2 Hint 1.
阅读全文
posted @
2017-08-17 16:06
Crutain
阅读(97)
推荐(0)
HDU 2756 & UVA 11572 Unique Snowflakes
摘要:Problem Description Emily the entrepreneur has a cool business idea: packaging and selling snowflakes. She has devised a machine that captures snowfla
阅读全文
posted @
2017-08-17 11:40
Crutain
阅读(144)
推荐(0)
HDU 1010 Prime Ring Problem
摘要:A ring is compose of n circles as shown in diagram. Put natural number 1, 2, ..., n into each circle separately, and the sum of numbers in two adjacen
阅读全文
posted @
2017-08-09 23:29
Crutain
阅读(107)
推荐(0)
Codeforces 735D. Taxes
摘要:Mr. Funt now lives in a country with a very specific tax laws. The total income of mr. Funt during this year is equal to n (n ≥ 2) burles and the amou
阅读全文
posted @
2017-08-06 14:42
Crutain
阅读(135)
推荐(0)
poj 2349 Arctic Network
摘要:Description The Department of National Defence (DND) wishes to connect several northern outposts by a wireless network. Two different communication te
阅读全文
posted @
2017-08-04 14:41
Crutain
阅读(119)
推荐(0)
hdu 1596 find the safest road
摘要:Problem Description XX星球有很多城市,每个城市之间有一条或多条飞行通道,但是并不是所有的路都是很安全的,每一条路有一个安全系数s,s是在 0 和 1 间的实数(包括0,1),一条从u 到 v 的通道P 的安全度为Safe(P) = s(e1)*s(e2)…*s(ek) e1,e
阅读全文
posted @
2017-08-04 12:56
Crutain
阅读(115)
推荐(0)
Codeforces 768B. Code For 1
摘要:Jon fought bravely to rescue the wildlings who were attacked by the white-walkers at Hardhome. On his arrival, Sam tells him that he wants to go to Ol
阅读全文
posted @
2017-08-02 19:33
Crutain
阅读(153)
推荐(0)
Codeforces 448C. Painting Fence
摘要:Bizon the Champion isn't just attentive, he also is very hardworking. Bizon the Champion decided to paint his old fence his favorite color, orange. Th
阅读全文
posted @
2017-08-02 16:43
Crutain
阅读(218)
推荐(0)
Problem D. Ice Cream Tower(2016 China-Final)
摘要:Mr. Panda likes ice cream very much especially the ice cream tower. An ice cream tower consists of K ice cream balls stacking up as a tower. In order
阅读全文
posted @
2017-08-01 19:58
Crutain
阅读(189)
推荐(0)
poj 2785 4 Values whose Sum is 0
摘要:Description The SUM problem can be formulated as follows: given four lists A, B, C, D of integer values, compute how many quadruplet (a, b, c, d ) ∈ A
阅读全文
posted @
2017-08-01 19:37
Crutain
阅读(102)
推荐(0)
Codeforces 797C. Minimal string
摘要:Petya recieved a gift of a string s with length up to 105 characters for his birthday. He took two more empty strings t and u and decided to play a ga
阅读全文
posted @
2017-08-01 19:19
Crutain
阅读(224)
推荐(0)