自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Steve·Curcy

一只菜鸡的挣扎史

  • 博客(22)
  • 收藏
  • 关注

原创 std::endl与'\n'的区别(c++基础)

“\n” 表示内容为一个回车符的字符串。std::endl 是流操作子,输出的作用和输出 “\n” 类似,但可能略有区别。std::endl 输出一个换行符,并立即刷新缓冲区。例如:std::cout << std::endl;相当于: std::cout << '\n' << std::flush;

2018-09-30 22:31:09 9232 1

原创 HDU - 1517 - A Multiplication Game

Stan and Ollie play the game of multiplication by multiplying an integer p by one of the numbers 2 to 9. Stan always starts with p = 1, does his multiplication, then Ollie multiplies the number, then ...

2018-09-30 18:21:34 141

原创 HDU - 1527 - 取石子游戏(威佐夫博弈)

有两堆石子,数量任意,可以不同。游戏开始由两个人轮流取石子。游戏规定,每次有两种不同的取法,一是可以在任意的一堆中取走任意多的石子;二是可以在两堆中同时取走相同数量的石子。最后把石子全部取完者为胜者。现在给出初始的两堆石子的数目,如果轮到你先取,假设双方都采取最好的策略,问最后你是胜者还是败者。Input输入包含若干行,表示若干种石子的初始情况,其中每一行包含两个非负整数a和b,表示两堆石子的...

2018-09-30 16:24:00 157

原创 HDU - 3951 - Coin Game(nim博弈)

After hh has learned how to play Nim game, he begins to try another coin game which seems much easier.The game goes like this:Two players start the game with a circle of n coins.They take coins fr...

2018-09-26 10:43:26 193

转载 博弈论总结

一. 巴什博奕(Bash Game):A和B一块报数,每人每次报最少1个,最多报4个,看谁先报到30。这应该是最古老的关于巴什博奕的游戏了吧。其实如果知道原理,这游戏一点运气成分都没有,只和先手后手有关,比如第一次报数,A报k个数,那么B报5-k个数,那么B报数之后问题就变为,A和B一块报数,看谁先报到25了,进而变为20,15,10,5,当到5的时候,不管A怎么报数,最后一个数肯定是B报的...

2018-09-22 15:27:34 175

原创 分石子(思维题 & 二进制)

Description有n个石子,将它分成k堆,对于[1,n]的任意一个数,都能用某几堆石子组成(每一堆只能用一次),求k的最小值。Input多组样例输入输出,输入n(1=<n<=1e18)Output每个测试样例输出k,占一行,k的含义如题目所述Sample Input 1621Sample Output 1321Hint分成的任意两个石子堆中石子个数可...

2018-09-22 11:23:02 913

原创 nefu117 - 素数个数的位数(素数定理)

Description小明是一个聪明的孩子,对数论有着很浓烈的兴趣。他发现求1到正整数10n 之间有多少个素数是一个很难的问题,该问题的难以决定于n 值的大小。现在的问题是,告诉你n的值,让你帮助小明计算小于10n的素数的个数值共有多少位?Input输入数据有若干组,每组数据包含1个整数n(1 < n < 1000000000),若遇到EOF则处理结束。Output对应每...

2018-09-19 11:28:02 497

原创 CodeForces - 574D - Bear and Blocks(双向 dp )

Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for t...

2018-09-19 10:24:44 207

原创 HDU - 1525 - Euclid's Game(博弈问题)

Two players, Stan and Ollie, play, starting with two natural numbers. Stan, the first player, subtracts any positive multiple of the lesser of the two numbers from the greater of the two numbers, prov...

2018-09-19 08:16:34 222

原创 nefu115 - 斐波那契的整除(思维 & 数论)

题目链接Time Limit:1000ms Memory Limit:65536KDescription已知斐波那契数列有如下递归定义,f(1)=1,f(2)=1, 且n>=3,f(n)=f(n-1)+f(n-2),它的前几项可以表示为1, 1,2 ,3 ,5 ,8,13,21,34…,现在的问题是想知道f(n)的值是否能被3和4整除,你知道吗?Input输入数据有若干组,每组数据...

2018-09-17 20:48:32 627

原创 HDU - 2099 - 整除的尾数

题目链接一个整数,只知道前几位,不知道末二位,被另一个整数除尽了,那么该数的末二位该是什么呢?Input输入数据有若干组,每组数据包含二个整数a,b(0<a<10000, 10<b<100),若遇到0 0则处理结束。Output对应每组数据,将满足条件的所有尾数在一行内输出,格式见样本输出。同组数据的输出,其每个尾数之间空一格,行末没有空格。Sample Inp...

2018-09-17 20:29:24 155

原创 CodeForces - 608C - Chain Reaction (dp & 二分)

题目链接 There are n beacons located at distinct positions on a number line. The i-th beacon has position ai and power level bi. When the i-th beacon is activated, it destroys all beacons to its left (di...

2018-09-11 10:57:01 194

原创 HDU - 5916 - Harmonic Value Description (思维 & 构造)

题目链接 The harmonic value of the permutation p1,p2,⋯pnp1,p2,⋯pn is n-1 ∑ gcd(pi.pi+1) i= 1Mr. Frog is wondering about the permutation whose harmonic value is the strictly k-th smallest among a...

2018-09-07 14:48:32 130

原创 FZU - 2214 - Knapsack problem(背包 & 思维)

Given a set of n items, each with a weight w[i] and a value v[i], determine a way to choose the items into a knapsack so that the total weight is less than or equal to a given limit B and the total va...

2018-09-07 09:50:58 157

原创 HDU - 5912 - Fraction (模拟)

题目链接 Mr. Frog recently studied how to add two fractions up, and he came up with an evil idea to trouble you by asking you to calculate the result of the formula below: As a talent, can you figur...

2018-09-07 08:55:40 264

原创 HDU - 1863 - 畅通工程(最小生成树)

题目链接 省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可)。经过调查评估,得到的统计表中列出了有可能建设公路的若干条道路的成本。现请你编写程序,计算出全省畅通需要的最低成本。 Input 测试输入包含若干测试用例。每个测试用例的第1行给出评估的道路条数 N、村庄数目M ( < 100 );随后的 N 行对应村...

2018-09-02 12:38:07 204

原创 POJ - 3250 - Bad Hair Day (单调栈)

Some of Farmer John’s N cows (1 ≤ N ≤ 80,000) are having a bad hair day! Since each cow is self-conscious about her messy hairstyle, FJ wants to count the number of other cows that can see the top of ...

2018-09-02 11:04:51 193

原创 POJ - 2823 - Sliding Window (单调栈)

An array of size n ≤ 10 6 is given to you. There is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each tim...

2018-09-02 10:05:29 344 3

原创 HDU - 1506 - Largest Rectangle in a Histogram (单调栈)

A histogram is a polygon composed of a sequence of rectangles aligned at a common base line. The rectangles have equal widths but may have different heights. For example, the figure on the left shows ...

2018-09-01 14:43:33 198

原创 POJ - 2492 - A Bug's Life (种类并查集)

Background Professor Hopper is researching the sexual behavior of a rare species of bugs. He assumes that they feature two different genders and that they only interact with bugs of the opposite gen...

2018-09-01 14:03:54 108

原创 CodeForces - 566D - Restructuring Company (并查集)

Even the most successful company can go through a crisis period when you have to make a hard decision — to restructure, discard and merge departments, fire employees and do other unpleasant stuff. Let...

2018-09-01 12:17:54 204

原创 HDU - 2473 - Junk-Mail Filter (并查集)

Recognizing junk mails is a tough task. The method used here consists of two steps: 1) Extract the common characteristics from the incoming email. 2) Use a filter matching the set of common charac...

2018-09-01 09:43:50 160

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除