07 2018 档案
摘要:"Good man never makes girls wait or breaks an appointment!" said the mandarin duck father. Softly touching his little ducks' head, he ...
阅读全文
摘要:Problem DescriptionLittle Q likes solving math problems very much. Unluckily, however, he does not have good spatial ability. Everytim...
阅读全文
摘要:定义:欧拉回路:每条边恰好只走一次,并能回到出发点的路径欧拉路径:经过每一条边一次,但是不要求回到起始点欧拉回路存在性的判定:无向图每个顶点的度数都是偶数,则存在欧拉回路。有向图每个节顶点的入度都等于出度,则存在欧拉回路。欧拉路径存在性的判定:有向图 : 图连通,当且...
阅读全文
摘要:const int MAXN = 1050;int N;int tree[MAXN][MAXN];int lowbit(int x){ return x&(-x);}void Add(int x,int y,int val){ for (i...
阅读全文
摘要:Suppose that the fourth generation mobile phone base stations in the Tampere area operate as follows. The area is divided into squares...
阅读全文
摘要:Given an N*N matrix A, whose elements are either 0 or 1. A[i, j] means the number in the i-th row and j-th column. Initially we have A...
阅读全文
摘要:方法一:自力更生#include using namespace std;int main(){ unsigned int a = 0; int MAX_int = (~a)/2; cout/ 中定义了宏:INT_MAX和INT_MIN可以拿来直接用#include...
阅读全文
摘要:Several currency exchange points are working in our city. Let us suppose that each point specializes in two particular currencies and ...
阅读全文
摘要:Like everyone else, cows like to stand close to their friends when queuing for feed. FJ has N (2 #include #include using namespace std...
阅读全文
摘要:时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 262144K,其他语言524288KSpecial Judge, 64bit IO Format: %lld题目描述Eddy likes to play cards game since there ar...
阅读全文
摘要:2008年OI集训论文上有介绍,其主要是结合了链表和数组各自的优点,链表中的节点指向每个数据块,即数组,并且记录数据的个数,然后分块查找和插入。头文件:#include 命名空间:using namespace __gnu_cxx基本操作:rope test;test...
阅读全文
摘要:皮克定理: 皮克定理是一个计算点阵中顶点在格点上的多边形面积公式,该公式可以表示为2S=2a+b-2,其中a表示多边形内部的点数,b表示多边形边界上的点数,S表示多边形的面积。无名定理(分数小数互化,判断是否是有限小数或无限循环小数):一个分数如果它的分母是10^n(...
阅读全文
摘要:1000ms 65536K在一个平面坐标系中,我们可以选出三个不全在一条线上的点构成一个三角形。我们称一个在三角形内(不包含三角形的边上),横纵坐标皆为整数的点位这个三角形的内点。 对于一个由(0,0)、(n,m)、(p,0)作为顶点构成的三角形,请你设计程序求出他的...
阅读全文
摘要:const int MAXN =1e3+10;const int INF = 0x3f3f3f3f;int mapp[MAXN][MAXN];int dis[MAXN];bool mark[MAXN];int num[MAXN];//用于检测负权环 int N;//点...
阅读全文
摘要:Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1695 Accepted Submission(s)...
阅读全文
摘要:输入n个字符串s[i],你要把他们按某个顺序连接起来,使得字典序最小。(1 using namespace std;const int MAXN = 120;bool cmp(string a,string b){ return a+b >N; for(int i=0...
阅读全文
摘要:时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 262144K,其他语言524288K题目描述输入描述:输入数据共一行,一个正整数n,意义如“问题描述”。输出描述:输出一行描述答案:一个正整数k,表示S的末尾有k个0示例1输入10输出7说明题解:难以描述...
阅读全文
摘要:题目描述 Apojacsleam喜欢数组。 他现在有一个n个元素的数组a,而他要对a[L]-a[R]进行M次操作: 操作一:将a[L]-a[R]内的元素都加上P 操作二:将a[L]-a[R]内的元素都减去P 最后询问a[...
阅读全文
摘要:Mr. Frog has two sequences a1,a2,⋯,an and b1,b2,⋯,bm and a number p. He wants to know the number of positions q such that sequence b1,...
阅读全文
摘要:有N个任务需要执行,第i个任务计算时占R[i]个空间,而后会释放一部分,最后储存计算结果需要占据O[i]个空间(O[i] =b[1] >=…>=b[x] b[x],所以前者更大,所以-a[x + 1] + b[x + 1] – a[x]不会产生负数。 因此我们证明了...
阅读全文
摘要:一:有若干个活动,第i个开始时间和结束时间是[Si,fi),只有一个教室,活动之间不能交叠,求最多安排多少个活动?分析: 我们就是想提高教室地利用率,尽可能多地安排活动。考虑容易想到的几种贪心策略:(1) 开始最早的活动优先,目标是想尽早结束活动,让出教室。然而, 这...
阅读全文
摘要:时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 131072K,其他语言262144K64bit IO Format: %lld题目描述White Cloud has built n stores numbered from 1 to n.White R...
阅读全文
摘要:Recently, paleoanthropologists have found historical remains on an island in the Atlantic Ocean. The most inspiring thing is that they...
阅读全文
摘要:#include #include using namespace std;const int MAXN = 1e5+10;struct T{ int L,R;//分别指向左右子树 int sum;//该节点所管辖区间范围内数的个数 T(){ sum = 0; }}...
阅读全文
摘要:Give you a sequence and ask you the kth big number of a inteval.InputThe first line is the number of the test cases.For each test case...
阅读全文
摘要:话说现在猪肉价格这么贵,著名的ACBoy 0068 也开始了养猪生活。说来也奇怪,他养的猪一出生第二天开始就能每天中午生一只小猪,而且生下来的竟然都是母猪。不过光生小猪也不行,0068采用了一个很奇特的办法来管理他的养猪场:对于每头刚出生的小猪,在他生下第二头小猪后立...
阅读全文
摘要:小K手中有n张牌,每张牌上有一个一位数的数,这个字数不是0就是5。小K从这些牌在抽出任意张(不能抽0张),排成一行这样就组成了一个数。使得这个数尽可能大,而且可以被90整除。注意:1.这个数没有前导0,2.小K不需要使用所有的牌。 Input每个测试数据输入共2行。第...
阅读全文
摘要:性质1:如果数a、b都能被c整除,那么它们的和(a+b)或差(a-b)也能被c整除。性质2:几个数相乘,如果其中有一个因数能被某一个数整除,那么它们的积也能被这个数整除。能被2整除的数,个位上的数能被2整除(偶数都能被2整除),那么这个数能被2整除能被3整除的数,各个...
阅读全文
摘要:Running a taxi station is not all that simple. Apart from the obvious demand for a centralised coordination of the cabs in order to pi...
阅读全文
摘要:Once upon a time there lived a king and he had N sons. And there were N beautiful girls in the kingdom and the king knew about each of...
阅读全文
摘要:const int MAXN = 205;bool board[MAXN][MAXN];//存边 int color[MAXN];//用于染色法判断是否是二分图 int N,M;//N个点M条边 bool Judge(int x){ for(int i=1 ; i<=...
阅读全文
摘要:There are a group of students. Some of them may know each other, while others don't. For example, A and B know each other, B and C kno...
阅读全文
摘要:const int MAXN = ;const int INF = 0x3f3f3f3f; struct Edge{ int flow,to,rev; Edge(){} Edge(int a,int b,int c):to(a),flow(b),rev(c){}}; ...
阅读全文
摘要:const int INF = 0x3f3f3f3f;const int MAXN = ; struct Edge{ int value,flow,to,rev; Edge(){} Edge(int a,int b,int c,int d):to(a),value(...
阅读全文
摘要:(1)二分图的最大匹配匈牙利算法(可以用最大流做,但一般匈牙利要快不少)。(2)二分图的最小点覆盖二分图的最小点覆盖 = 二分图的最大匹配(3)二分图的最少边覆盖二分图的最少边覆盖 = 点数 - 二分图的最大匹配(4)二分图的最大独立集二分图的最大独立集 = 点数 -...
阅读全文
摘要:Consider a town where all the streets are one-way and each street leads from one intersection to another. It is also known that starti...
阅读全文
摘要:转载自:https://blog.csdn.net/jarjingx/article/details/8521690序言 最近花了一点心思研究2-sat模型,看了很多论文博客等等,也在POJ上做了一点题。其实这个东西也还挺好玩的,当然,前提是每道题你...
阅读全文
摘要:Recently, the γ galaxies broke out Star Wars. Each planet is warring for resources. In the Star Wars, Planet X is under attack by othe...
阅读全文
摘要:freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
阅读全文
摘要:This story happened on the background of Star Trek.Spock, the deputy captain of Starship Enterprise, fell into Klingon’s trick and was...
阅读全文
摘要:Tom and Jerry are playing a game with tubes and pearls. The rule of the game is:1) Tom and Jerry come up together with a number K.2) T...
阅读全文
摘要:Monkey A lives on a tree, he always plays on this tree. One day, monkey A learned about one of the bit-operations, xor. He was keen...
阅读全文
摘要:typedef struct Node* node;struct Node{ int val; int num; node Next[2]; Node() { val = num = 0; memset(Next,NULL,sizeof(Next)); }};vo...
阅读全文
摘要:John is a manager of a CPU chip factory, the factory produces lots of chips everyday. To manage large amounts of products, every proce...
阅读全文
摘要:Zeus 和 Prometheus 做了一个游戏,Prometheus 给 Zeus 一个集合,集合中包含了N个正整数,随后 Prometheus 将向 Zeus 发起M次询问,每次询问中包含一个正整数 S ,之后 Zeus 需要在集合当中找出一个正整数 K ,使...
阅读全文
摘要:Ignatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀). Input 输入数据的第一部分是一张单词表,每行一个...
阅读全文
摘要:题目:点击打开链接代码:#include #include #include #include #include using namespace std;char s[15];typedef struct Node* node;struct Node{ int Num...
阅读全文
摘要:char s[MAXN];typedef struct Node* node;struct Node{ int Num;//常见的是存数,具体的根据题更改 node Next[26]; Node() { Num = 0; memset(Next,NULL,siz...
阅读全文
摘要:转载自:大佬传送门/******************************************************* Name : sscanf.c ** Author : gzshun** Version : 1....
阅读全文
摘要:You have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign language....
阅读全文
摘要:Little A is an astronomy lover, and he has found that the sky was so beautiful!So he is counting stars now!There are n stars in the sk...
阅读全文
摘要:方法:暴力复杂度:O(msqrt(m))步骤:按点的度数分成两类,分别暴力①统计每个点的度数②入度sqrt(m)的分为第二类③对于第一类,暴力每个点,然后暴力这个点的任意两条边,再判断这两条边的另一个端点是否连接因为m条边最多每条边遍历一次,然后暴力的点的入度 map...
阅读全文
摘要:无向连通图的DFS树中有两类节点可以成为割点:对根节点u,若其有两棵或两棵以上的子树,则该根结点u为割点;对非叶子节点u(非根节点),若其子树的节点均没有指向u的祖先节点的回边,说明删除u之后,根结点与u的子树的节点不再连通,则节点u为割点。const int MAX...
阅读全文
摘要:A Telephone Line Company (TLC) is establishing a new telephone cable network. They are connecting several places numbered by integers ...
阅读全文
摘要:2012 If this is the end of the world how to do? I do not know how. But now scientists have found that some stars, who can live, but ...
阅读全文
摘要:A number of schools are connected to a computer network. Agreements have been developed among those schools: each school ...
阅读全文
摘要:Your platoon of wandering lizards has entered a strange room in the labyrinth you are exploring. As you are looking around for hidde...
阅读全文
摘要:You, the head of Department of Security, recently received a top-secret information that a group of terrorists is planning to transpor...
阅读全文
摘要: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 pos...
阅读全文
摘要:In the vast waters far far away, there are many islands. People are living on the islands, and all the transport among the islands rel...
阅读全文
摘要:A power network consists of nodes (power stations, consumers and dispatchers) connected by power transport lines. A node u may be supp...
阅读全文
摘要:Dearboy, a goods victualer, now comes to a big problem, and he needs your help. In his sale area there are N shopkeepers (marked from ...
阅读全文
摘要:On 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...
阅读全文
摘要:You are in charge of setting up the press room for the inaugural meeting of the United Nations Internet eXecutive (UNIX),...
阅读全文
摘要:Cows are such finicky eaters. Each cow has a preference for certain foods and drinks, and she will consume no others. ...
阅读全文