
dhkj
文章平均质量分 79
墨碎江南
这个作者很懒,什么都没留下…
展开
-
Beautiful People ZOJ - 2319
The most prestigious sports club in one city has exactly N members. Each of its members is strong and beautiful. More precisely, i-th member of this club (members being numbered by the time they entere原创 2017-04-19 08:37:41 · 265 阅读 · 0 评论 -
FZU - 2209 老S的旅行计划(最短路spfa)
老S在某城市生活的非常不自在,想趁着ICPC举办期间在省内转转。已知老S所在的省有N个城市,M条无向边(对于某一对结点可能出现重边)。由于省内的交通相当糟糕,通过某条边所需要花费的时间受到一天中不同时刻的影响。此外对于某一时刻(一天24小时的任意一个整点算一个时刻),从任何方向通过无向边所需要的时间相同。现在老S想请你帮他规划一下旅行路线。Input第一行输入为一个整数T表示测试个数T对于每一个测...原创 2018-03-28 11:08:03 · 122 阅读 · 0 评论 -
CodeForces - 612D The Union of k-Segments (优先队列)
You are given n segments on the coordinate axis Ox and the number k. The point is satisfied if it belongs to at least k segments. Find the smallest (by the number of segments) set of segments on the c...原创 2018-04-11 09:28:41 · 298 阅读 · 0 评论 -
CodeForces - 754D Fedor and coupons (优先队列)
All our characters have hobbies. The same is true for Fedor. He enjoys shopping in the neighboring supermarket.The goods in the supermarket have unique integer ids. Also, for every integer there is a ...原创 2018-03-28 19:03:15 · 202 阅读 · 0 评论 -
CodeForces - 586D Phillip and Trains(bfs)
The mobile application store has a new game called "Subway Roller".The protagonist of the game Philip is located in one end of the tunnel and wants to get out of the other one. The tunnel is a rectang...原创 2018-03-28 20:24:36 · 157 阅读 · 0 评论 -
POJ - 2785 4 Values whose Sum is 0 (二分)
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 x B x C x D are such that a + b + c + d = 0 . In the followin...原创 2018-04-04 17:27:50 · 93 阅读 · 0 评论 -
HDU - 1171 Big Event in HDU
Nowadays, we all know that Computer College is the biggest department in HDU. But, maybe you don't know that Computer College had ever been split into Computer College and Software College in 2002. Th...原创 2018-04-18 09:36:19 · 107 阅读 · 0 评论 -
UVA - 12295 Optimal Symmetric Paths(spfa)
题意:求(1,1)到(n,n)点的路径中有多少条为最短路径,而且行走的路径要以对角线对称;解 :我们可以先以对角线为对称,把右下的值加到对称的左上的值中,然后从(1,1)走到对角线就行,而且我们可以让对角线所有点和ed点加上1条路径,长度为0。 我们让左上及对角线上的点逐一编号,而且把临近的两个点建边 每个点有两个值 dis[i] (代表最短距离)和pp[i](代表最短路径的数量),最后我们得...原创 2018-04-06 16:36:37 · 180 阅读 · 0 评论 -
Kattis - speed (二分)
Sheila is a student and she drives a typical student car: it is old, slow, rusty, and falling apart. Recently, the needle on the speedometer fell off. She glued it back on, but she might have placed i...原创 2018-04-13 11:30:21 · 252 阅读 · 0 评论 -
51 nod 1686 第K大区间(二分+尺取)
定义一个区间的值为其众数出现的次数。现给出n个数,求将所有区间的值排序后,第K大的值为多少。众数(统计学/数学名词)_百度百科 Input第一行两个数n和k(1<=n<=100000,k<=n*(n-1)/2) 第二行n个数,0<=每个数<2^31Output一个数表示答案。Sample Input4 21 2 3 2Sample Output2解 :我们要注意的是...原创 2018-04-07 11:57:43 · 162 阅读 · 0 评论 -
UVA - 167 The Sultan's Successors (八皇后 回溯)
The Sultan of Nubia has no children, so she has decided that the country will be split into up to kseparate parts on her death and each part will be inherited by whoever performs best at some test. It...原创 2018-04-13 14:25:33 · 224 阅读 · 0 评论 -
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. It was de...原创 2018-05-17 08:42:24 · 234 阅读 · 0 评论 -
中位数计数 51Nod - 1682
中位数定义为所有值从小到大排序后排在正中间的那个数,如果值有偶数个,通常取最中间的两个数值的平均数作为中位数。现在有n个数,每个数都是独一无二的,求出每个数在多少个包含其的区间中是中位数。Input第一行一个数n(n<=8000) 第二行n个数,0<=每个数<=10^9OutputN个数,依次表示第i个数在多少包含其的区间中是中位数。Sample Input51 2 3 4 5...原创 2018-04-26 21:06:33 · 191 阅读 · 0 评论 -
Sliding Window POJ - 2823 (优先队列 或者 滚动rmq 或者 单调栈 )
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-05-17 21:11:57 · 374 阅读 · 0 评论 -
Xiongnu's Land UVALive - 7261
Wei Qing (died 106 BC) was a military general of the Western Han dynasty whose campaigns againstthe Xiongnu earned him great acclaim. He was a relative of Emperor Wu because he was the youngerhalf-b...原创 2018-11-10 18:45:58 · 224 阅读 · 0 评论 -
Snake Carpet UVALive - 7269 (构造)
In school of EECS of Peking University, there is a homework for all freshman — the contest of AIsnakes. This contest is ended today. Bacchus has got a very good result, so he decides to make a carpet...原创 2018-11-10 18:47:23 · 165 阅读 · 0 评论 -
Race to 1 Again LightOJ - 1038 (期望)
Rimi learned a new thing about integers, which is - any positive integer greater than 1 can be divided by its divisors. So, he is now playing with this property. He selects a number N. And he calls th...原创 2018-11-10 18:48:37 · 130 阅读 · 0 评论 -
Frog and Portal HihoCoder - 1873 (二进制拆分)
A small frog wants to get to the other side of a river. The frog is initially located at one bank of the river (position 0) and wants to get to the other bank (position 200). Luckily, there are 199 le...原创 2018-11-14 20:57:40 · 444 阅读 · 0 评论 -
POJ - 3026 Borg Maze (bfs+最小生成树)
The Borg is an immensely powerful race of enhanced humanoids from the delta quadrant of the galaxy. The Borg collective is the term used to describe the group consciousness of the Borg civilization. E...原创 2018-04-02 20:11:15 · 121 阅读 · 0 评论 -
HDU - 4528 小明系列故事——捉迷藏 (广搜)
小明的妈妈生了三个孩子,老大叫大明, 老二叫二明, 老三..., 老三自然就叫小明了。 一天,小明的妈妈带小明兄弟三人去公园玩耍,公园里面树木很多,有很多地方可以藏身, 于是他们决定玩捉迷藏。经过几轮的猜拳后,第一轮是小明来找其他两个人,游戏规则很简单: 只要小明可以在规定的时间内找到他们就算小明获胜,并且被发现的两个人猜拳决定谁在下一轮负责找人;如果在规定的时间内只找到一个人,那么没有被发现...原创 2018-03-27 16:50:18 · 170 阅读 · 0 评论 -
对称与反对称 (“景驰科技杯”2018年华南理工大学程序设计竞赛)(逆元)
链接:https://www.nowcoder.com/acm/contest/94/H来源:牛客网题目描述给出一个N*N的方阵A。构造方阵B,C: 使得A = B + C.其中 B为对称矩阵,C为反对称矩阵。 对于方阵S中的任意元素,若(S)ij = (S)ji,则称S为对称矩阵 对于方阵T中的任意元素,若(T)ij = -(T)ji,则称T为反对称矩阵 注意,所有运算在模M意义下输入描述:输入...原创 2018-04-09 18:29:10 · 523 阅读 · 2 评论 -
poj 1236 Network of Schools(连通图缩点)
A number of schools are connected to a computer network. Agreements have been developed among those schools: each school maintains a list of schools to which it distributes software (the “receiving sc...原创 2018-03-06 20:40:37 · 183 阅读 · 0 评论 -
poj1144-Network(求割点)
A Telephone Line Company (TLC) is establishing a new telephone cable network. They are connectingseveral places numbered by integers from 1 to N. No two places have the same number. The linesare bidir...原创 2018-03-07 13:32:49 · 185 阅读 · 0 评论 -
UVA 796 - Critical Links (求桥)
In a computer network a link L, which interconnects two servers, is considered critical if there are atleast two servers A and B such that all network interconnection paths between A and B pass throug...原创 2018-03-07 20:05:27 · 228 阅读 · 0 评论 -
poj3177Redundant Paths(双连通分量)
In order to get from one of the F (1 <= F <= 5,000) grazing fields (which are numbered 1..F) to another field, Bessie and the rest of the herd are forced to cross near the Tree of Rotten Apples....原创 2018-03-08 12:25:36 · 184 阅读 · 0 评论 -
POJ 1523 SPF 求割点及对应的连通分量数
Consider the two networks shown below. Assuming that data moves around these networks only between directly connected nodes on a peer-to-peer basis, a failure of a single node, 3, in the network on th...原创 2018-03-14 19:12:26 · 251 阅读 · 0 评论 -
POJ1470/ZOJ1141 Closest Common Ancestors(LCA离线算法)
Write a program that takes as input a rooted tree and a list of pairs of vertices. For each pair (u,v) the program determines the closest common ancestor of u and v in the tree. The closest common anc...原创 2018-03-15 13:30:17 · 133 阅读 · 0 评论 -
poj1986 Distance Queries (lca模板)
Farmer John's cows refused to run in his marathon since he chose a path much too long for their leisurely lifestyle. He therefore wants to find a path of a more reasonable length. The input to this pr...原创 2018-03-15 20:06:12 · 196 阅读 · 0 评论 -
poj 2342 Anniversary party (树形dp)
There is going to be a party to celebrate the 80-th Anniversary of the Ural State University. The University has a hierarchical structure of employees. It means that the supervisor relation forms a tr...原创 2018-03-16 11:01:14 · 123 阅读 · 0 评论 -
HDU - 2196 Computer (树形dp详解)
A school bought the first computer some time ago(so this computer's id is 1). During the recent years the school bought N-1 new computers. Each new computer was connected to one of settled earlier. Ma...原创 2018-03-16 14:20:41 · 308 阅读 · 0 评论 -
POJ 2356 Find a multiple (在n个数组成的数列中找出若干个连续数使它们之和能被n整除)
The input contains N natural (i.e. positive integer) numbers ( N <= 10000 ). Each of that numbers is not greater than 15000. This numbers are not necessarily different (so it may happen that two or...原创 2018-03-18 19:09:16 · 849 阅读 · 0 评论 -
POJ - 3723 Conscription POJ(最小生成树)
Windy has a country, and he wants to build an army to protect his country. He has picked up N girls and M boys and wants to collect them to be his soldiers. To collect a soldier without any privilege,...原创 2018-04-07 21:37:40 · 148 阅读 · 0 评论 -
hdu 4135 Co-prime(容斥原理)
Given a number N, you are asked to count the number of integers between A and B inclusive which are relatively prime to N. Two integers are said to be co-prime or relatively prime if they have no comm...原创 2018-03-21 14:18:52 · 138 阅读 · 0 评论 -
hdu 2841 Visible Trees (容斥原理)
There are many trees forming a m * n grid, the grid starts from (1,1). Farmer Sherlock is standing at (0,0) point. He wonders how many trees he can see. If two trees and Sherlock are in one line, Farm...原创 2018-03-21 18:35:42 · 216 阅读 · 0 评论 -
UVA - 624 (01背包)
You have a long drive by car ahead. You have a tape recorder, but unfortunately your best music is onCDs. You need to have it on tapes so the problem to solve is: you have a tape N minutes long. Howto...原创 2018-03-31 20:21:08 · 333 阅读 · 0 评论 -
欧拉函数
------------------------------------------------------原博客 ---------------------------------------------------------- 对正整数n,欧拉函数是少于或等于n的数中与n互质的数的数目。例如euler(8)=4,因为1,3,5,7均和8互质。 Euler函数表达通式:euler(x...转载 2018-03-22 10:25:41 · 126 阅读 · 0 评论 -
素数筛法
原博客:http://blog.youkuaiyun.com/once_hnu/article/details/6302283 素数是ACM中数论题目常常涉及到得问题。最基本的问题就是如何判断一个数是素数以及如何快速的打出题目涉及范围的素数表。当然数论中关于素数的问题会比较复杂,在这里仅就素数的不同筛法做出总结。 素数,就是只有1和自身两个约数的正整数。2是最小的素数。根据定义,我们就可以直接判断...转载 2018-03-22 10:27:18 · 128 阅读 · 0 评论 -
第13届景驰-埃森哲杯广东工业大学ACM程序设计大赛 D (最长公共子序列)
链接:https://www.nowcoder.com/acm/contest/90/D来源:牛客网题目描述 掌握未来命运的女神 psd 师兄在拿了朝田诗乃的 buff 后决定去实习。 埃森哲公司注册成立于爱尔兰,是一家全球领先的专业服务公司,为客户提供战略、咨询、数字、技术和运营服务及解决方案。他们立足商业与技术的前沿,业务涵盖40多个行业,以及企业日常运营部门的各个职能。凭借独特的业内...原创 2018-03-26 18:58:50 · 144 阅读 · 0 评论 -
TCP/IP网络编程
在github上记录了自己网络编程的学习https://github.com/msyyyy/TCP-IP-NetworkNote原创 2019-03-20 16:50:34 · 540 阅读 · 0 评论