poj 2492A Bug's Life】的更多相关文章

http://poj.org/problem?id=2492 #include<cstdio> #include<cstring> #include<algorithm> #include<iostream> #define maxn 100010 int p[maxn],rela[maxn]; using namespace std; int n,m; void make() { ; i<=n; i++) { p[i]=i; rela[i]=; }…
/* 目大意:输入一个数t,表示测试组数.然后每组第一行两个数字n,m,n表示有n只昆虫,编号从1—n,m表示下面要输入m行交配情况,每行两个整数,表示这两个编号的昆虫为异性,要交配. 要求统计交配过程中是否出现冲突,即是否有两个同性的昆虫发生交配. 思路:并查集 将同性的昆虫放入集合之中,如果输入的昆虫u, v同时出现在了集合中,那么 u,v就是同性的!发生了同性交配的可能! */ #include <string> #include <cstdio> #include <…
Description Bugs Integrated, Inc. is a major manufacturer of advanced memory chips. They are launching production of a new six terabyte Q-RAM chip. Each chip consists of six unit squares arranged in a form of a 2*3 rectangle. The way Q-RAM chips are…
题目地址:http://poj.org/problem?id=2586 /* 题意:某公司要统计全年盈利状况,对于每一个月来说,如果盈利则盈利S,如果亏空则亏空D. 公司每五个月进行一次统计,全年共统计8次(1-5.2-6.3-7.4-8.5-9.6-10.7-11.8-12), 已知这8次统计的结果全部是亏空(盈利-亏空<0).题目给出S和D,判断全年是否能盈利, 如果能则求出盈利的最大值,如果不能盈利则输出Deficit 贪心 or 枚举 1. 贪心抓住亏损的月尽量在5个月的后面,这样可以被…
1.Link: http://poj.org/problem?id=2586 2.Content: Y2K Accounting Bug Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 10520   Accepted: 5257 Description Accounting for Computer Machinists (ACM) has sufferred from the Y2K bug and lost some…
http://poj.org/problem?id=2586 大意是一个公司在12个月中,或固定盈余s,或固定亏损d. 但记不得哪些月盈余,哪些月亏损,只能记得连续5个月的代数和总是亏损(<0为亏损),而一年中只有8个连续的5个月,分别为1~5,2~6,…,8~12 问全年是否可能盈利?若可能,输出可能最大盈利金额,否则输出“Deficit". 贪心,符合最优子结构性质.5个月统计一次都亏空,那么有5种情况:       1.若SSSSD亏空,那么全年可能最大盈利情况为: SSSSDSSS…
链接: http://poj.org/problem?id=2586 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=26733#problem/C Y2K Accounting Bug Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 8472   Accepted: 4185 Description Accounting for Computer Machini…
链接: http://poj.org/problem?id=2586 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=26733#problem/C Y2K Accounting Bug Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 8472   Accepted: 4185 Description Accounting for Computer Machini…
A Bug's Life POJ - 2492 Background Professor Hopper is researching the sexual behavior of a rare species of bugs. He assumes that they feature two different genders and that they only interact with bugs of the opposite gender. In his experiment, indi…
传送门:A Bug's Life Description Background Professor Hopper is researching the sexual behavior of a rare species of bugs. He assumes that they feature two different genders and that they only interact with bugs of the opposite gender. In his experiment,…