07 2016 档案

摘要:题目大意:有一个整数集合Z,现在给出n个整数区间[a,b]以及|Z∩[a,b]|的最少个数c,让你求这个整数集合的最小有多少解题思路:差分约束系统+spfa差分约束系统事实上就是一个构图的过程比如说现在有n个不等式X1 - X2 #include #include #include #include... 阅读全文
posted @ 2016-07-31 22:09 _Wilbert 阅读(99) 评论(0) 推荐(0)
摘要:题目大意:求∑gcd(x^a-1, x^b-1)对1e9+7取模的值解题思路:官方题解:首先有等式({x}^{a}-1x​a​​−1,{x}^{b}-1x​b​​−1)={x}^{gcd(a,b)}-1x​gcd(a,b)​​−1成立,相当于计算\sum \sum {x}^{gcd(a,b)}-1∑... 阅读全文
posted @ 2016-07-31 16:27 _Wilbert 阅读(138) 评论(0) 推荐(0)
摘要:题目大意:给定一个数x,求正整数y\geq 2y≥2,使得满足以下条件:1.y-x的绝对值最小2.y的质因数分解式中每个质因数均恰好出现2次。解题思路:由于y质因数分解式中每个质因数均出现2次,那么y是一个完全平方数,设y=z*z,题目可转换成求z,使得每个质因数出现1次. 我们可以暴力枚举z,检查... 阅读全文
posted @ 2016-07-31 14:20 _Wilbert 阅读(117) 评论(0) 推荐(0)
摘要:题目大意:小白在玩一个游戏。桌子上有n张多米诺骨牌排成一列。它有k次机会,每次可以选一个还没有倒的骨牌,向左或者向右推倒。每个骨牌倒下的时候,若碰到了未倒下的骨牌,可以把它推倒。小白现在可以随意设置骨牌的高度,但是骨牌高度为整数,且至少为1,并且小白希望在能够推倒所有骨牌的前提下,使所有骨牌高度的和... 阅读全文
posted @ 2016-07-31 14:14 _Wilbert 阅读(138) 评论(0) 推荐(0)
摘要:题目大意:给定一个数列,求是否存在连续子列和为m的倍数,存在输出YES,否则输出NO解题思路:官方题解:预处理前缀和,一旦有两个数模m的值相同,说明中间一部分连续子列可以组成m的倍数。 另外,利用抽屉原理,我们可以得到,一旦n大于等于m,答案一定是YES 复杂度 O(n)代码:#include #i... 阅读全文
posted @ 2016-07-31 14:07 _Wilbert 阅读(125) 评论(0) 推荐(0)
摘要:题目大意:给你p个人,有q条路径,这q条路径是有向的,问你从1号点走到其它各个点再走回来的cost总和是多少解题思路:因为p和q非常大, 都是1e6的数据大小,可以选择两种思路,一个是dijkstra+heap优化可以达到O(nlogn)的时间复杂度另外一个是spfa可以达到O(ke)的时间复杂度其... 阅读全文
posted @ 2016-07-30 21:43 _Wilbert 阅读(149) 评论(0) 推荐(0)
摘要:DescriptionConsider two natural numbers A and B. Let S be the sum of all natural divisors of A^B. Determine S modulo 9901 (the rest of the division of... 阅读全文
posted @ 2016-07-27 20:58 _Wilbert 阅读(132) 评论(0) 推荐(0)
摘要:DescriptionGiven a connected undirected graph, tell if its minimum spanning tree is unique. Definition 1 (Spanning Tree): Consider a connected, undire... 阅读全文
posted @ 2016-07-26 17:12 _Wilbert 阅读(118) 评论(0) 推荐(0)
摘要:DescriptionAndrew is working as system administrator and is planning to establish a new network in his company. There will be N hubs in the company, t... 阅读全文
posted @ 2016-07-26 14:13 _Wilbert 阅读(133) 评论(0) 推荐(0)
摘要:DescriptionConsider the following 5 picture frames placed on an 9 x 8 array. ........ ........ ........ ........ .CCC....EEEEEE.. ........ ........ ..... 阅读全文
posted @ 2016-07-26 13:42 _Wilbert 阅读(132) 评论(0) 推荐(0)
摘要:DescriptionWindy has N balls of distinct weights from 1 unit to N units. Now he tries to label them with 1 to N in such a way that:No two balls share ... 阅读全文
posted @ 2016-07-25 20:21 _Wilbert 阅读(183) 评论(0) 推荐(0)
摘要:DescriptionIn this problem you have to solve a very simple maze consisting of:a 6 by 6 grid of unit squares3 walls of length between 1 and 6 which are... 阅读全文
posted @ 2016-07-25 19:18 _Wilbert 阅读(137) 评论(0) 推荐(0)
摘要:DescriptionDuring winter, the most hungry and severe time, Holedox sleeps in its lair. When spring comes, Holedox wakes up, moves to the exit of its l... 阅读全文
posted @ 2016-07-25 15:36 _Wilbert 阅读(190) 评论(0) 推荐(0)
摘要:Descriptiona program that, given a natural number N between 0 and 4999 (inclusively), and M distinct decimal digits X1,X2..XM (at least one), finds th... 阅读全文
posted @ 2016-07-25 10:38 _Wilbert 阅读(128) 评论(0) 推荐(0)
摘要:DescriptionBoudreaux likes to multitask, especially when it comes to using his computer. Never satisfied with just running one application at a time, ... 阅读全文
posted @ 2016-07-24 19:18 _Wilbert 阅读(108) 评论(0) 推荐(0)
摘要:DescriptionAn ascending sorted sequence of distinct values is one in which some form of a less-than operator is used to order the elements from smalle... 阅读全文
posted @ 2016-07-24 16:32 _Wilbert 阅读(161) 评论(0) 推荐(0)
摘要:DescriptionThe GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large rectangular... 阅读全文
posted @ 2016-07-24 11:51 _Wilbert 阅读(159) 评论(0) 推荐(0)
摘要:Description未名湖附近共有N个大小湖泊L1, L2, ..., Ln(其中包括未名湖),每个湖泊Li里住着一只青蛙Fi(1 ≤ i ≤ N)。如果湖泊Li和Lj之间有水路相连,则青蛙Fi和Fj互称为邻居。现在已知每只青蛙的邻居数目x1, x2, ..., xn,请你给出每两个湖泊之间的相连... 阅读全文
posted @ 2016-07-24 11:00 _Wilbert 阅读(115) 评论(0) 推荐(0)
摘要:Problem DescriptionGive you a sequence of N(N≤100,000) integers : a1,...,an(0#include #include #include #include using namespace std;typedef long long... 阅读全文
posted @ 2016-07-21 23:13 _Wilbert 阅读(146) 评论(0) 推荐(0)
摘要:Problem DescriptionAn abandoned country has n(n≤100000) villages which are numbered from 1 to n. Since abandoned for a long time, the roads need to be... 阅读全文
posted @ 2016-07-21 19:59 _Wilbert 阅读(144) 评论(0) 推荐(0)
摘要:Description顺利潜入勺林寺几天后,方丈给了西瓜一个光荣而艰巨的任务——打扫寺庙中的道路。同时给了西瓜一张勺林寺的地图。西瓜这才知道,勺林寺中总共有n座房子,但道路只有n-1条,这n-1条道路连接了寺中的所有房子,即保证在任何两座房子都能沿着道路抵达。好在西瓜人缘不错,他知道每座房子中都有个... 阅读全文
posted @ 2016-07-20 15:09 _Wilbert 阅读(168) 评论(0) 推荐(0)
摘要:A tree is an undirected connected graph without cycles.Let's consider a rooted undirected tree with n vertices, numbered 1 through n. There are many w... 阅读全文
posted @ 2016-07-20 14:59 _Wilbert 阅读(130) 评论(0) 推荐(0)
摘要:Vasya has n days of vacations! So he decided to improve his IT skills and do sport. Vasya knows the following information about each of this n days: w... 阅读全文
posted @ 2016-07-20 14:55 _Wilbert 阅读(289) 评论(0) 推荐(0)
摘要:You are given a description of a depot. It is a rectangular checkered field of n × m size. Each cell in a field can be empty (".") or it can be occupi... 阅读全文
posted @ 2016-07-20 14:46 _Wilbert 阅读(170) 评论(0) 推荐(0)
摘要:There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it.... 阅读全文
posted @ 2016-07-20 14:41 _Wilbert 阅读(163) 评论(0) 推荐(0)
摘要:Palace Accepts: 28 Submissions: 307 Time Limit: 8000/4000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)问题描述为了寻找失去的爱人Cupid,Psyche需要完成... 阅读全文
posted @ 2016-07-18 20:17 _Wilbert 阅读(181) 评论(0) 推荐(0)
摘要:Wool Accepts: 109 Submissions: 770 Time Limit: 8000/4000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)问题描述黎明时,Venus为Psyche定下了第二个任务。她... 阅读全文
posted @ 2016-07-18 20:14 _Wilbert 阅读(114) 评论(0) 推荐(0)
摘要:Arrange Accepts: 221 Submissions: 1401 Time Limit: 8000/4000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)问题描述Cupid一不小心将爱情之箭射到了自己,他爱... 阅读全文
posted @ 2016-07-18 20:10 _Wilbert 阅读(156) 评论(0) 推荐(0)
摘要:Oracle Accepts: 599 Submissions: 2576 Time Limit: 8000/4000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)问题描述曾经有一位国王,统治着一片未名之地。他膝下有三... 阅读全文
posted @ 2016-07-18 20:04 _Wilbert 阅读(122) 评论(0) 推荐(0)
摘要:Barney lives in country USC (United States of Charzeh). USC has n cities numbered from 1 through n and n - 1 roads between them. Cities and roads of U... 阅读全文
posted @ 2016-07-17 13:46 _Wilbert 阅读(127) 评论(0) 推荐(0)
摘要:Barney is standing in a bar and starring at a pretty girl. He wants to shoot her with his heart arrow but he needs to know the distance between him an... 阅读全文
posted @ 2016-07-15 13:19 _Wilbert 阅读(228) 评论(0) 推荐(0)
摘要:Barney lives in NYC. NYC has infinite number of intersections numbered with positive integers starting from 1. There exists a bidirectional road betwe... 阅读全文
posted @ 2016-07-15 13:06 _Wilbert 阅读(152) 评论(0) 推荐(0)
摘要:Description给定自然数N和十进制集合X={x1,x2,...,xm}(0 q = new LinkedList(); int[] vis = new int[n]; q.clear(); for(int i = 0; i = 0) break; ... 阅读全文
posted @ 2016-07-11 14:39 _Wilbert 阅读(150) 评论(0) 推荐(0)
摘要:Pari wants to buy an expensive chocolate from Arya. She has n coins, the value of the i-th coin is ci. The price of the chocolate is k, so Pari will t... 阅读全文
posted @ 2016-07-01 13:07 _Wilbert 阅读(201) 评论(0) 推荐(0)
摘要:Today Pari and Arya are playing a game called Remainders.Pari chooses two positive integer x and k, and tells Arya k but not x. Arya have to find the ... 阅读全文
posted @ 2016-07-01 12:41 _Wilbert 阅读(181) 评论(0) 推荐(0)
摘要:Recently, Pari and Arya did some research about NP-Hard problems and they found the minimum vertex cover problem very interesting.Suppose the graph G ... 阅读全文
posted @ 2016-07-01 12:31 _Wilbert 阅读(150) 评论(0) 推荐(0)
摘要:Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and... 阅读全文
posted @ 2016-07-01 12:27 _Wilbert 阅读(165) 评论(0) 推荐(0)
摘要:Arya has n opponents in the school. Each day he will fight with all opponents who are present this day. His opponents have some fighting plan that gua... 阅读全文
posted @ 2016-07-01 12:25 _Wilbert 阅读(176) 评论(0) 推荐(0)