自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(52)
  • 收藏
  • 关注

原创 F-子序列(组合数,打表,扩展欧拉,容斥)

题目链接题目描述给出一个长度为n的序列,你需要计算出所有长度为k的子序列中,除最大最小数之外所有数的乘积相乘的结果输入描述:第一行一个整数T,表示数据组数。对于每组数据,第一行两个整数N,k,含义如题所示接下来一行N个整数,表示给出的序列保证序列内的数互不相同输出描述:对于每组数据,输出一个整数表示答案,对取模每组数据之间以换行分割输...

2018-08-30 20:11:26 273

原创 HDU Problem - 5918 Sequence I

题目链接Problem DescriptionMr. Frog has two sequences a1,a2,⋯,ana1,a2,⋯,ana_1,a_2,\cdots ,a_n and b1,b2,⋯,bmb1,b2,⋯,bmb_1,b_2,\cdots ,b_m and a number p. He wants to know the number of positions q suc...

2018-08-29 11:52:53 191

原创 牛客练习赛25 B-最长区间

题目链接:题目描述给你一个长度为 n 的序列 a ,求最长的连续的严格上升区间的长度。 同时会进行 m 次修改,给定 x , y ,表示将 ax 修改为 y ,每次修改之后都要求输出答案。输入描述:第一行 2 个数 n,m,表示序列长度,修改次数; 接下来一行 n 个数表示 ;接下来 m 行,每行 2 个数 x , y ,描述一次修改。输出描述:...

2018-08-28 18:05:24 242

原创 HDU Problem - 5976 Detachment(逆元,阶乘打表,数学)

题目链接Problem DescriptionIn a highly developed alien society, the habitats are almost infinite dimensional space.In the history of this planet,there is an old puzzle.You have a line segment with x u...

2018-08-28 17:04:02 172

原创 HDU Problem - 5971 Wrestling Match(染色)

题目链接Problem DescriptionNowadays, at least one wrestling match is held every year in our country. There are a lot of people in the game is “good player”, the rest is “bad player”. Now, Xiao Ming is...

2018-08-27 11:31:33 205

原创 HDU Problem - 5935 Car(模拟)

题目链接Problem DescriptionRuins is driving a car to participating in a programming contest. As on a very tight schedule, he will drive the car without any slow down, so the speed of the car is non-de...

2018-08-27 09:25:28 302

原创 Codeforces Round #506 (Div. 3) - F. Multicolored Markers (思维)

题意给两种颜色的数量 a 和 b,这两种颜色恰好组成一个长方形,而且至少有一种颜色在整个长方形里面也是个长方形,求满足条件中周长最小的情况AC当a是里面的长方形,把A能组成的长方形的宽记录一下,然后枚举大的长方形的宽 i ,当大长方形的长sum(a + b)/ i 大于等于小长方形的长a / i,这是就可以构成一个合理的长方形按照上面的思路分别假设a、b为里面的小长方形#in...

2018-08-26 20:23:03 233

原创 遍历一颗树

遍历整棵树,计算一个点到所有点的距离并记录前驱节点 节点从1标号 - bfs遍历整棵树vector<int> g[N];int pre[N], dis[N];struct point{ int num, dis;};bool vis[N];void bfs(int x) { queue<point> que; que.push(...

2018-08-26 17:27:18 449

原创 Codeforces Round #506 (Div. 3) - E. Tree with Small Distances

题目链接题意给你一棵树,最多加几条边,使点1到所有的点的最大距离不超过2AC贪心从距离最远的点开始,找到他的父节点,然后把父节点相连的点删去,这样最好的情况可以删除三层点遍历树的时候有两种方法:// bfs#include <iostream>#include <cmath>#include <map>#include &l

2018-08-26 17:20:51 186

原创 Codeforces Round #506 (Div. 3) - D. Concatenated Multiples(思维)

题意给你N个数字和一个K,问一共有几种拼接数字的方式使得到的数字是K的倍数,拼接:“234”和“123”拼接得到“234123”ACN <= 2e5,简单的暴力O(N^2)枚举肯定超时数字A和B拼接,B的位数最多10位,如果我们知道位数为(1-10)的数字和A拼接满足是K的倍数这样的数字有几个,就可以在N*10的复杂度下完成所有的拼接在读入数据的时候,我们可以统计出数字...

2018-08-26 13:25:41 233

原创 Codeforces Round #506 (Div. 3) - C. Maximal Intersection (思维,模拟)

这里写链接内容题意给你N个线段(一条直线上),问删去一个之后,最长公共长度AC先考虑不删边,有两种情况 所有直线在一起分布 显然公共部分是排序之后的(第一个右端点 - 最后一个左端点)直线不在一起分布 这时按照(第一个右端点 - 最后一个左端点)得到的结果是负数,最后可以加个判断,可以解决这个情况知道上面的两种情况后,可以在O(1)的时间求出最长的公共部分,将所...

2018-08-25 10:27:52 294

原创 牛客练习赛25 因数个数和

题目链接题目描述q次询问,每次给一个x,问1到x的因数个数的和。输入描述:第一行一个正整数q ; 接下来q行,每行一个正整数 x输出描述:共q行,每行一个正整数表示答案示例1输入412310输出13527说明1的因数有12的因数有1,23的因数有1,3以此类推备注:1<=q...

2018-08-24 22:50:09 363

原创 HDU Problem - 5938 Four Operations

题目链接Problem DescriptionLittle Ruins is a studious boy, recently he learned the four operations!Now he want to use four operations to generate a number, he takes a string which only contains digits...

2018-08-24 15:35:58 172

原创 HDU Problem - 6214 Smallest Minimum Cut(最小割边,两种方法)

题目链接Problem DescriptionConsider a network G=(V,E)G=(V,E)G=(V,E) with source sss and sink ttt. An s-t cut is a partition of nodes set VVV into two parts such that sss and ttt belong to different pa...

2018-08-23 18:49:21 161

原创 HDU Problem - 2732 Leapin' Lizards(最大流,拆点建边)

题目链接Problem DescriptionYour platoon of wandering lizards has entered a strange room in the labyrinth you are exploring. As you are looking around for hidden treasures, one of the rookies steps on ...

2018-08-23 15:38:55 250

原创 HDU Problem - 4289 Control(最大流)

题目链接Problem Description  You, the head of Department of Security, recently received a top-secret information that a group of terrorists is planning to transport some WMD 1 from one city (the sourc...

2018-08-23 14:16:16 205

原创 POJ 1459 -- Power Network(最大流, 建图)

题目链接DescriptionA power network consists of nodes (power stations, consumers and dispatchers) connected by power transport lines. A node u may be supplied with an amount s(u) >= 0 of power, may ...

2018-08-23 13:55:27 156

原创 HDU Problem - 1533 Going Home(费用流板子题)

题目链接Problem DescriptionOn a grid map there are n little men and n houses. In each unit time, every little man can move one unit step, either horizontally, or vertically, to an adjacent point. For ...

2018-08-23 11:20:52 386

原创 POJ 2516 -- Minimum Cost (最小费用最大流, 必须分开建图)

题目链接DescriptionDearboy, a goods victualer, now comes to a big problem, and he needs your help. In his sale area there are N shopkeepers (marked from 1 to N) which stocks goods from him.Dearboy has...

2018-08-23 11:03:40 262

原创 费用流:spfa && Dijkstra

模板#include <iostream>#include <stdio.h>#include <map>#include <vector>#include <queue>#include <cmath>#include &am

2018-08-23 10:34:43 447

原创 HDU Problem - 4292 Food(最大流, 建边)

题目链接Problem Description  You, a part-time dining service worker in your college’s dining hall, are now confused with a new problem: serve as many people as possible.  The issue comes up as people ...

2018-08-22 00:13:10 117

原创 HDU Problem - 4280 Island Transport(最大流)

题目链接Problem Description  In the vast waters far far away, there are many islands. People are living on the islands, and all the transport among the islands relies on the ships.  You have a transpo...

2018-08-21 23:52:39 139

原创 HDU Problem - 3338 Kakuro Extension (最大流,建图)

题目链接Problem DescriptionIf you solved problem like this, forget it.Because you need to use a completely different algorithm to solve the following one.Kakuro puzzle is played on a grid of “black” ...

2018-08-21 18:02:27 242

原创 无意中发现一个有趣的事情

刚看完最近热门的几部剧,关网页的时候看到一个关于2018年雅加达亚运会的消息,虽然我不怎么关注网页中推送的消息,但是看到 孙杨 + 200米自由泳 + 夺冠,就成功的触动了我的神经 毕竟是咱中国人拿了冠军嘛,点进去看看(毕竟颓废了一天了。。。),有趣的事情又发生了,请看下图: 如果没有看出来蹊跷的话,那么看这个(顺便说下这个是新浪军事): 作为一名的男同志,这两个数据触动...

2018-08-20 00:12:46 1238

原创 POJ 1087 -- A Plug for UNIX(最大流,建图)(文末有极限数据)

题目链接DescriptionYou are in charge of setting up the press room for the inaugural meeting of the United Nations Internet eXecutive (UNIX), which has an international mandate to make the free flow of...

2018-08-18 13:43:26 344

原创 POJ 3436 -- ACM Computer Factory(最大流,建图)

题目链接DescriptionAs you know, all the computers used for ACM contests must be identical, so the participants compete on equal terms. That is why all these computers are historically produced at the ...

2018-08-17 22:14:27 172

原创 POJ 3281 -- Dining(最大流,拆点建图)

题目链接DescriptionCows are such finicky eaters. Each cow has a preference for certain foods and drinks, and she will consume no others.Farmer John has cooked fabulous meals for his cows, but he forgo...

2018-08-17 21:24:35 188

原创 HDU Problem - 6383 p1m2(二分)

题目链接Problem Description度度熊很喜欢数组!!我们称一个整数数组为稳定的,若且唯若其同时符合以下两个条件:1. 数组里面的元素都是非负整数。2. 数组里面最大的元素跟最小的元素的差值不超过 111。举例而言,[1,2,1,2][1,2,1,2][1, 2, 1, 2] 是稳定的,而 [−1,0,−1][−1,0,−1][-1, 0, -1] 跟 [1,2,3][1,2,...

2018-08-17 09:44:33 157

原创 POJ 1064 -- Cable master(二分)

题目链接DescriptionInhabitants of the Wonderland have decided to hold a regional programming contest. The Judging Committee has volunteered and has promised to organize the most honest contest ever. I...

2018-08-17 09:34:35 162

原创 HDU Problem - 1969 Pie(二分,精度)

题目链接Problem DescriptionMy 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 various sizes. F of my friends are comi...

2018-08-16 22:21:06 182

原创 HDU Problem - 3763 CD(二分)

题目链接Problem DescriptionJack and Jill have decided to sell some of their Compact Discs, while they still have some value. They have decided to sell one of each of the CD titles that they both own. ...

2018-08-16 21:59:29 155

原创 读写挂

有些题目读入的数据很大,就需要用读写挂了// 加快读写 namespace IO { const int MX = 4e7; char buf[MX]; int c, sz; void begin() { c = 0; sz = fread(buf, 1, MX, stdin); } inline bool read...

2018-08-16 20:06:37 179

原创 HDU Problem - 6396 Swordsman(优先队列,模拟)

题目链接Problem DescriptionLawson is a magic swordsman with kkk kinds of magic attributes v1,v2,v3,…,vkv1,v2,v3,…,vkv_1, v_2, v_3, \dots, v_k. Now Lawson is faced with nnn monsters and the iii-th mons...

2018-08-16 20:00:20 150

原创 HDU Problem - 5101 Select(二分)

题目链接Problem DescriptionOne day, Dudu, the most clever boy, heard of ACM/ICPC, which is a very interesting game. He wants to take part in the game. But as we all know, you can’t get good result wit...

2018-08-16 16:50:05 186

原创 POJ 3258 -- River Hopscotch(二分)

题目链接DescriptionEvery year the cows hold an event featuring a peculiar version of hopscotch that involves carefully jumping from rock to rock in a river. The excitement takes place on a long, strai...

2018-08-16 10:20:17 152

原创 POJ 3061 -- Subsequence(二分)

题目链接DescriptionA sequence of N positive integers (10 < N < 100 000), each of them less than or equal 10000, and a positive integer S (S < 100 000 000) are given. Write a program to find t...

2018-08-16 09:22:37 146

原创 HDU Problem - 3085 Nightmare Ⅱ(双向BFS)

题目链接Problem DescriptionLast night, little erriyue had a horrible nightmare. He dreamed that he and his girl friend were trapped in a big maze separately. More terribly, there are two ghosts in the...

2018-08-15 11:01:59 144

原创 HDU Problem - 5113 Black And White(搜索剪枝)

题目链接Problem DescriptionIn mathematics, the four color theorem, or the four color map theorem, states that, given any separation of a plane into contiguous regions, producing a figure called a map,...

2018-08-15 09:37:36 134

原创 HDU Problem - 1455 Sticks

题目链接Problem DescriptionGeorge took sticks of the same length and cut them randomly until all parts became at most 50 units long. Now he wants to return sticks to the original state, but he forgot ...

2018-08-14 22:49:23 177

原创 Problem - 4828 Grids

题目链接Problem Description  度度熊最近很喜欢玩游戏。这一天他在纸上画了一个2行N列的长方形格子。他想把1到2N这些数依次放进去,但是为了使格子看起来优美,他想找到使每行每列都递增的方案。不过画了很久,他发现方案数实在是太多了。度度熊想知道,有多少种放数字的方法能满足上面的条件?Input  第一行为数据组数T(1<=T<=100000)。  然...

2018-08-09 20:34:24 208

空空如也

空空如也

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

TA关注的人

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