题意: 给出n个白点和n个黑点的坐标,要求用n条不相交的线段把它们连接起来,其中每条线段恰好连接一个白点和一个黑点,每个点恰好连接到一条线段 解析: 带入负的欧几里得距离求就好了 假设a1-b1 与 a2-b2相交 则dis(a1, b1) + dis(a2, b2) 一定大于 dis(a1, b2) + dis(a2, b1) 四边形的对角线一定大于两条对边... 所以..边的权值取负的欧几里得距离..来一次km就好了   km是求最大  而负的最大 对应整的最小 而整的最小 又能对应不相交…
奔小康赚大钱 Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 12628    Accepted Submission(s): 5548 Problem Description 传说在遥远的地方有一个非常富裕的村落,有一天,村长决定进行制度改革:重新分配房子.这可是一件大事,关系到人民的住房问题啊.村里共有n间房间,刚好有n家老百姓,考虑…
uva 1411 Ants Description Young naturalist Bill studies ants in school. His ants feed on plant-louses that live on apple trees. Each ant colony needs its own apple tree to feed itself. Bill has a map with coordinates of n ant colonies and n apple tre…
Young naturalist Bill studies ants in school. His ants feed onplant-louses that live on apple trees. Each ant colony needsits own apple tree to feed itself.Bill has a map with coordinates of n ant colonies and napple trees. He knows that ants travel…
UVA 1411 - Ants 题目链接 题意:给定一些黑点白点,要求一个黑点连接一个白点,而且全部线段都不相交 思路:二分图完美匹配,权值存负的欧几里得距离,这种话,相交肯定比不相交权值小,所以做一次完美匹配就能够了 代码: #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> using namespace std; const int MAXNODE = 1…
UVa 489 题目大意:计算机给定一个单词让你猜,你猜一个字母,若单词中存在你猜测的字母,则会显示出来,否则算出错, 你最多只能出错7次(第6次错还能继续猜,第7次错就算你失败),另注意猜一个已经猜过的单词也算出错, 给定计算机的单词以及猜测序列,判断玩家赢了(You win).输了(You lose).放弃了(You chickened out) /* UVa 489 HangmanJudge --- 水题 */ #include <cstdio> #include <cstring…
题目大意:给出一个由O和X组成的串(长度为1-80),统计得分. 每个O的分数为目前连续出现的O的个数,例如,OOXXOXXOOO的得分为1+2+0+0+1+0+0+1+2+3 解题思路:用一个变量term记录当前O的分数,若出现O,则term+1,若出现X,则term=0: 再用一个sum记录总和,没次加上term即可 /* UVa 1585 Score --- 水题 */ #include <cstdio> #include <cstring> ; int main() { i…
http://codeforces.com/gym/101484/problem/E 题解 凸包板题 #define _CRT_SECURE_NO_WARNINGS #include<cmath> #include<iostream> #include<stdio.h> #include<algorithm> #include<cstring> #include<vector> using namespace std; #define…
Oil Skimming Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3426    Accepted Submission(s): 1432 Problem Description Thanks to a certain "green" resources company, there is a new profitabl…
省选前刷道LCT板题(话说之前没做这道题-) CODE #include<bits/stdc++.h> using namespace std; inline void read(int &num) { char ch; int flg = 1; while(!isdigit(ch=getchar()))if(ch=='-')flg = -flg; for(num=0; isdigit(ch); num=num*10+ch-'0', ch=getchar()); num*=flg; }…