C/C++ ACM
文章平均质量分 87
ACM相关题目
ling_wang
小白要奋斗~~~
展开
-
51Nod 数组中和等于K的数对(暴力)
给出一个整数K和一个无序数组A,A的元素为N个互不相同的整数,找出数组A中所有和等于K的数对。例如K = 8,数组A:{-1,6,5,3,4,2,9,0,8},所有和等于8的数对包括(-1,9),(0,8),(2,6),(3,5)。 Input 第1行:用空格隔开的2个数,K N,N为A数组的长度。(2 <= N <= 50000,-10^9 <= K <= 1...原创 2018-06-06 19:49:42 · 160 阅读 · 0 评论 -
codeforces 508 B Anton and currency you all know(水)
Berland, 2016. The exchange rate of currency you all know against the burle has increased so much that to simplify the calculations, its fractional part was neglected and the exchange rate is now assu...原创 2018-06-06 21:13:21 · 270 阅读 · 0 评论 -
Codeforces 834(426 Div.2) C.The Meaningless Game(pow函数)
Slastyona and her loyal dog Pushok are playing a meaningless game that is indeed very interesting.The game consists of multiple rounds. Its rules are very simple: in each round, a natural number k i...原创 2018-06-02 15:37:08 · 153 阅读 · 0 评论 -
CodeForces - 716B Complete the Word(暴力)
ZS the Coder loves to read the dictionary. He thinks that a word is nice if there exists a substring (contiguous segment of letters) of it of length 26 where each letter of English alphabet appears ex...原创 2018-04-08 14:07:56 · 263 阅读 · 0 评论 -
834A. The Useless Toy
A. The Useless Toy time limit per test 1 second memory limit per test 256 megabytes input standard input output standard outputWalking through the streets of Marshmallow City, Slastyona have sp原创 2017-11-18 14:37:01 · 267 阅读 · 0 评论 -
hdu 1686 Oulipo(kmp)
The French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter 'e'. He was a member of the Oulipo group. A quote from the book:Tout avait Pair normal, mais tout s...原创 2018-05-01 11:04:29 · 138 阅读 · 0 评论 -
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-07-31 10:24:27 · 190 阅读 · 0 评论 -
CodeForces - 1010A Fly(暴力)
Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on n−2 intermediate planets. Formally: we number all the planets from 1 to n. 1 is Earth, n is ...原创 2018-08-06 21:56:45 · 780 阅读 · 0 评论 -
poj 3278 Catch That Cow(bfs)
Farmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a point N (0 ≤ N ≤ 100,000) on a number line and the cow is at a point K (0 ≤ K ≤ 100,0...原创 2018-08-01 19:45:57 · 173 阅读 · 0 评论 -
poj 2251 Dungeon Master(bfs)
You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. It takes one minute to move one unit north, south...原创 2018-08-01 18:48:13 · 188 阅读 · 0 评论 -
poj 3279 Fliptile(dfs+二进制枚举)
Farmer John knows that an intellectually satisfied cow is a happy cow who will give more milk. He has arranged a brainy activity for cows in which they manipulate an M × N grid (1 ≤ M ≤ 15; 1 ≤ N ≤ 15...原创 2018-08-02 16:08:05 · 250 阅读 · 0 评论 -
FZU - 2150 Fire Game(两点bfs)
Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, each grid of this board is consisting of grass or just empty and then they start...原创 2018-08-06 10:24:53 · 254 阅读 · 0 评论 -
FZU 1686 神龙的难题(重复覆盖问题)
这是个剑与魔法的世界.英雄和魔物同在,动荡和安定并存.但总的来说,库尔特王国是个安宁的国家,人民安居乐业,魔物也比较少.但是.总有一些魔物不时会进入城市附近,干扰人民的生活.就要有一些人出来守护居民们不被魔物侵害.魔法使艾米莉就是这样的一个人.她骑着她的坐骑,神龙米格拉一起消灭干扰人类生存的魔物,维护王国的安定.艾米莉希望能够在损伤最小的前提下完成任务.每次战斗前,她都用时间停止魔法停住时间,然后...原创 2018-07-27 10:07:49 · 637 阅读 · 0 评论 -
hdu 1698 Just a Hook(区间修改)
In the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several consecutive metallic sticks which are of the same length.Now Pudge w...原创 2018-08-16 10:12:16 · 962 阅读 · 0 评论 -
hdu 1754 I Hate It(单点更新+查询区间最大值)
很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。 这让很多学生很反感。不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。 Input 本题目包含多组测试,请处理到文件结束。 在每个测试的第一行,有两个正整数 N 和 M ( 0 < N<=200...原创 2018-08-13 19:21:26 · 522 阅读 · 0 评论 -
hdu1166 敌兵布阵(模板题 单点修改 + 区间查询)
C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视。 中央情报局要研究敌人究竟演习什么...原创 2018-08-13 15:53:50 · 664 阅读 · 0 评论 -
hdu 2612 Find a way(两点bfs)
圣诞节要到了,坤神和瑞瑞这对基佬想一起去召唤师大峡谷开开车。百度地图一下,发现周围的召唤师大峡谷还不少,这对基佬纠结着,该去哪一个。。。坤神:我要去左边的这个(因为离自己比较近 哈哈~)。。瑞瑞:我要去右边的这个(因为离自己比较近 嘿嘿~) ……..这对基佬闹矛盾了,开车有危险了! 为了不让他们去召唤师大峡谷坑人,riot决定让他们去X召唤师大峡谷,保证他俩所走的路程和最短。每走一个点需要花费1...原创 2018-08-09 19:47:28 · 770 阅读 · 0 评论 -
hdu 3038 How Many Answers Are Wrong(带权并查集)
TT and FF are … friends. Uh… very very good friends -__-bFF is a bad boy, he is always wooing TT to play the following game with him. This is a very humdrum game. To begin with, TT should write down...原创 2018-08-08 21:04:14 · 555 阅读 · 0 评论 -
poj 2236 Wireless Network(并查集)
An earthquake takes place in Southeast Asia. The ACM (Asia Cooperated Medical team) have set up a wireless network with the lap computers, but an unexpected aftershock attacked, all computers in the n...原创 2018-08-08 11:14:18 · 505 阅读 · 0 评论 -
hdu 6342 Expression in Memories(模拟)
Kazari remembered that she had an expression s0 before. Definition of expression is given below in Backus–Naur form. ::= | ::= “+” | “*” ::= “0” | ::= “” | ::= “0” | ::= “1” | “2...原创 2018-08-07 10:42:01 · 614 阅读 · 0 评论 -
hdu 6343 Graph Theory Homework(水)
There is a complete graph containing n vertices, the weight of the i-th vertex is wi. The length of edge between vertex i and j (i≠j) is ⌊|wi−wj|−−−−−−−√⌋. Calculate the length of the shortest path ...原创 2018-08-07 09:33:26 · 581 阅读 · 0 评论 -
hdu 6330 Problem L. Visual Cube(模拟)
Little Q likes solving math problems very much. Unluckily, however, he does not have good spatial ability. Everytime he meets a 3D geometry problem, he will struggle to draw a picture. Now he meets a...原创 2018-08-06 21:54:01 · 247 阅读 · 0 评论 -
hdu 1495 非常可乐(bfs)
大家一定觉的运动以后喝可乐是一件很惬意的事情,但是seeyou却不这么认为。因为每次当seeyou买了可乐以后,阿牛就要求和seeyou一起分享这一瓶可乐,而且一定要喝的和seeyou一样多。但seeyou的手中只有两个杯子,它们的容量分别是N 毫升和M 毫升 可乐的体积为S (S<101)毫升 (正好装满一瓶) ,它们三个之间可以相互倒可乐 (都是没有刻度的,且 S==N+M,101>S>...原创 2018-08-03 19:39:09 · 168 阅读 · 0 评论 -
hdu 6299 Balanced Sequence(模拟栈, 贪心)
Chiaki has n strings s1,s2,…,sn consisting of ‘(’ and ‘)’. A string of this type is said to be balanced:if it is the empty stringif A and B are balanced, AB is balanced,if A is balanced, (A) is b...原创 2018-08-01 09:55:05 · 172 阅读 · 0 评论 -
hdu 3032 Nim or not Nim?(博弈 SG)
Nim is a two-player mathematic game of strategy in which players take turns removing objects from distinct heaps. On each turn, a player must remove at least one object, and may remove any number of o...原创 2018-07-31 15:29:26 · 220 阅读 · 0 评论 -
hdu1846 Brave Game(巴什博弈 模板题)
十年前读大学的时候,中国每年都要从国外引进一些电影大片,其中有一部电影就叫《勇敢者的游戏》(英文名称:Zathura),一直到现在,我依然对于电影中的部分电脑特技印象深刻。 今天,大家选择上机考试,就是一种勇敢(brave)的选择;这个短学期,我们讲的是博弈(game)专题;所以,大家现在玩的也是“勇敢者的游戏”,这也是我命名这个题目的原因。 当然,除了“勇敢”,我还希望看到“...原创 2018-07-31 11:37:38 · 231 阅读 · 0 评论 -
hdu 1874 Good Luck in CET-4 Everybody!(博弈 SG函数)
大学英语四级考试就要来临了,你是不是在紧张的复习?也许紧张得连短学期的ACM都没工夫练习了,反正我知道的Kiki和Cici都是如此。当然,作为在考场浸润了十几载的当代大学生,Kiki和Cici更懂得考前的放松,所谓“张弛有道”就是这个意思。这不,Kiki和Cici在每天晚上休息之前都要玩一会儿扑克牌以放松神经。 “升级”?“双扣”?“红五”?还是“斗地主”? 当然都不是!那多俗...原创 2018-07-31 11:28:26 · 220 阅读 · 0 评论 -
hdu 1564 Play a game(博弈 找规律)
New Year is Coming! ailyanlu is very happy today! and he is playing a chessboard game with 8600. The size of the chessboard is n*n. A stone is placed in a corner square. They play alternativ...原创 2018-07-31 09:47:04 · 299 阅读 · 0 评论 -
hdu 1079 Calendar Game(博弈论 找规律)
Adam and Eve enter this year’s ACM International Collegiate Programming Contest. Last night, they played the Calendar Game, in celebration of this contest. This game consists of the dates from Januar...原创 2018-07-30 16:20:27 · 295 阅读 · 0 评论 -
HDU 2295 Radar(dancin links 重复覆盖问题 +二分)
N cities of the Java Kingdom need to be covered by radars for being in a state of war. Since the kingdom has M radar stations but only K operators, we can at most operate K radars. All radars have the...原创 2018-07-26 20:00:25 · 307 阅读 · 0 评论 -
HDU - 4763 Theme Section(kmp)
It’s time for music! A lot of popular musicians are invited to join us in the music festival. Each of them will play one of their representative songs. To make the programs more interesting and challe...原创 2018-07-24 11:42:11 · 251 阅读 · 0 评论 -
hdu 4300 Clairewd’s message(扩展kmp)
Clairewd is a member of FBI. After several years concealing in BUPT, she intercepted some important messages and she was preparing for sending it to ykwd. They had agreed that each letter of these mes...原创 2018-07-23 20:49:11 · 265 阅读 · 0 评论 -
hdu 2594 Simpsons’ Hidden Talents(kmp)
Homer: Marge, I just figured out a way to discover some of the talents we weren’t aware we had.Marge: Yeah, what is it?Homer: Take me for example. I want to find out if I have a talent in politics,...原创 2018-07-23 14:46:55 · 211 阅读 · 0 评论 -
hdu 1220 Cube(数学)
Cowl is good at solving math problems. One day a friend asked him such a question: You are given a cube whose edge length is N, it is cut by the planes that was paralleled to its side planes into N * ...原创 2018-05-31 21:57:12 · 313 阅读 · 0 评论 -
hdu 2050 折线分割平面(找规律)
我们看到过很多直线分割平面的题目,今天的这个题目稍微有些变化,我们要求的是n条折线分割平面的最大数目。比如,一条折线可以将平面分成两部分,两条折线最多可以将平面分成7部分,具体如下所示。 Input 输入数据的第一行是一个整数C,表示测试实例的个数,然后是C 行数据,每行包含一个整数n(0 < n <= 10000),表示折线的数量。Output 对于...原创 2018-05-31 19:40:23 · 224 阅读 · 0 评论 -
hdu 3746 Cyclic Nacklace(kmp)
CC always becomes very depressed at the end of this month, he has checked his credit card yesterday, without any surprise, there are only 99.9 yuan left. he is too distressed and thinking about how t...原创 2018-05-01 15:36:17 · 119 阅读 · 0 评论 -
HDU - 3347 Calculate the expression
You may find it’s easy to calculate the expression such as:a = 3b = 4c = 5a + b + c = ?Isn’t it?Input The first line contains an integer stands for the number of test cases. Each tes...原创 2018-03-17 20:00:06 · 219 阅读 · 0 评论 -
HDU 3343 An ant's story(积分)
Long long ago, there is an ant crawling on an L-meter magic rubber band with speed of v cm/s.The magic rubber band will elongate m meters every second. We can assume that the magic rubber band elongat...原创 2018-03-17 19:54:28 · 250 阅读 · 0 评论 -
hdu 2504 又见GCD
又见GCD Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 22598 Accepted Submission(s): 9312Problem Description 有三个正整数a,b,c(0#include<...原创 2018-03-17 09:46:05 · 193 阅读 · 0 评论 -
hdu3336 Count the string(kmp字符串比较)
It is well known that AekdyCoin is good at string problems as well as number theory problems. When given a string s, we can write down all the non-empty prefixes of this string. For example: s: “...原创 2018-01-20 21:39:53 · 276 阅读 · 0 评论