SCU 4442 Party】的更多相关文章

二分图的最小点权覆盖. 非常感谢巨巨@islands_的解答,还帮我画了一个图. 题目保证给出的边构成的图是一个二分图. 如果没有第三种类型的$frog$,那么问题就很简单了.即选择哪些点,覆盖住所有的边,并且要求选择的点的权值之和最小.可以转换成网络流来解决. 现在有第三种类型的$frog$,可以把这种$frog$拆成两个点,两点之间连边,然后其余和他有矛盾的点,分别向两个点中的一个点连边.画画图可以发现拆点之后的新图也是二分图.对这个图跑一次二分图的最小点权覆盖,如果拆点的边两端有一个点被选…
每个青蛙喝黑茶或者红茶或者都可以喝 M个矛盾关系 有矛盾的不能喝同种茶 但你可以花费Wi使得这个青蛙消除所有矛盾 把矛盾当作边 青蛙当作点 如果这两个青蛙只喝不同的一种茶就不建边 题目中保证了不存在奇环 可以黑白染色成二分图 然后把两个茶都可以喝的青蛙拆点 u表示该青蛙喝黑茶 u+n表示喝红茶 同时建边(u,u+n) 有四种情况: 1.两个青蛙都可以喝两种茶 建边(u,v) (u+n,v+n) 2.两个青蛙一个可以喝两种茶 一个可以喝黑茶 建边(u,v) 3.两个青蛙一个可以喝两种茶 一个可以喝…
Party n frogs are invited to a tea party. Frogs are conveniently numbered by 1,2,-,n. The tea party has black and green tea in service. Each frog has its own preference. He or she may drink only black/green tea or accept both. There are m pairs of fr…
SCU 4437  Carries Time Limit:0MS     Memory Limit:0KB     64bit IO Format:%lld & %llu  Practice  Description Carries frog has nn integers a1,a2,…,ana1,a2,…,an, and she wants to add them pairwise. Unfortunately, frog is somehow afraid of carries (进位).…
 SCU 4438 Censor Time Limit:0MS     Memory Limit:0KB     64bit IO Format:%lld & %llu  Practice Description Censor frog is now a editor to censor so-called sensitive words (敏感词). She has a long text pp. Her job is relatively simple -- just to find the…
 SCU 4440 Rectangle Time Limit:0MS     Memory Limit:0KB     64bit IO Format:%lld & %llu  Practice Description Rectangle frog has a piece of paper divided into nn rows and mm columns. Today, she would like to draw a rectangle whose perimeter is not gr…
A - A Time Limit:0MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Submit Status Practice SCU 4424 Description Time Limit: 1000ms Description Given N distinct elements, how many permutations we can get from all the possible subset of the eleme…
I NEED A OFFER!     64bit IO Format: %lld & %llu Submit Status Description Description Speakless很早就想出国,现在他已经考完了所有需要的考试,准备了所有要准备的材料, 于是,便需要去申请学校了.要申请国外的任何大学,你都要交纳一定的申请费用, 这可是很惊人的.Speakless没有多少钱,总共只攒了n万美元.他将在m个学校中选择若干的 (当然要在他的经济承受范围内).每个学校都有不同的申请费用a(万美…
Physical Examination Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 4442 Description WANGPENG is a freshman. He is requested to have a physical examination when entering the university. Now WAN…
SCU - 4440 Rectangle Time Limit: Unknown   Memory Limit: Unknown   64bit IO Format: %lld & %llu Submit Status Description Rectangle frog has a piece of paper divided into n rows and m columns. Today, she would like to draw a rectangle whose perimeter…
4436: Easy Math Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.scu.edu.cn/soj/problem.action?id=4436 Description Given n integers a1,a2,…,an, check if the sum of their square root a1+a2+…+an is a integer. Input The input consists of multiple…
题目链接:http://acm.scu.edu.cn/soj/problem/4440/ 题目大意:给一个n*m的方格,求周长小于等于k的矩形有多少个. 解题思路:我之前直接暴力,显然超时,所以后来发现,可以用等差数列的求前n项和公式来代替一层for循环,这样就只有一重循环了,不会超时. AC代码: #include <cstdio> #include <cmath> #include <cstring> #include <algorithm> #incl…
题目链接:http://acm.scu.edu.cn/soj/problem/4436/ 题意:给你n个整数,求这n个数的平方根和是否是一个整数: 解题思路:如果这题每个数给他算出来,必然费时间,可能还会超精度,所以巧妙的方法就是判断这些整数是否全是完全平方数,如果有一个不是,则他们的平方根和肯定不是一个整数. AC代码: #include <cstdio> #include <cmath> #include <cstring> #include <algorit…
题意:N个点.M条边(2 <= N <= 1000 , 0 <= M <= 10^5),每一个点有个权值W(0 <= W <= 10^5),现要去除一些点(不能去掉点0),使得结点 0 与结点 N - 1 不连通,求去掉的点的最小权值和. 题目链接:http://cstest.scu.edu.cn/soj/problem.action?id=3254 -->>这是很明显的最小点权割.. 建图方案: 1)将全部点 i 拆成 i 和 i + N.i ->…
HDU 4442 Physical Examination(贪心) 题目链接http://acm.split.hdu.edu.cn/showproblem.php?pid=4442 Description WANGPENG is a freshman. He is requested to have a physical examination when entering the university. Now WANGPENG arrives at the hospital. Er-.. Th…
POJ 2152 fire / SCU 2977 fire(树型动态规划) Description Country Z has N cities, which are numbered from 1 to N. Cities are connected by highways, and there is exact one path between two different cities. Recently country Z often caught fire, so the governm…
POJ 2289 Jamie's Contact Groups / UVA 1345 Jamie's Contact Groups / ZOJ 2399 Jamie's Contact Groups / HDU 1699 Jamie's Contact Groups / SCU 1996 Jamie's Contact Groups (二分,二分图匹配) Description Jamie is a very popular girl and has quite a lot of friends…
POJ 1087 A Plug for UNIX / HDU 1526 A Plug for UNIX / ZOJ 1157 A Plug for UNIX / UVA 753 A Plug for UNIX / UVAlive 5418 A Plug for UNIX / SCU 1671 A Plug for UNIX (网络流) Description You are in charge of setting up the press room for the inaugural meet…
POJ 2502 Subway / NBUT 1440 Subway / SCU 2186 Subway(图论,最短距离) Description You have just moved from a quiet Waterloo neighbourhood to a big, noisy city. Instead of getting to ride your bike to school every day, you now get to walk and take the subway.…
POJ 1511 Invitation Cards / UVA 721 Invitation Cards / SPOJ Invitation / UVAlive Invitation Cards / SCU 1132 Invitation Cards / ZOJ 2008 Invitation Cards / HDU 1535 (图论,最短路径) Description In the age of television, not many people attend theater perfor…
POJ 1502 MPI Maelstrom / UVA 432 MPI Maelstrom / SCU 1068 MPI Maelstrom / UVALive 5398 MPI Maelstrom /ZOJ 1291 MPI Maelstrom (最短路径) Description BIT has recently taken delivery of their new supercomputer, a 32 processor Apollo Odyssey distributed shar…
POJ 1797 Heavy Transportation / SCU 1819 Heavy Transportation (图论,最短路径) Description Background Hugo Heavy is happy. After the breakdown of the Cargolifter project he can now expand business. But he needs a clever man who tells him whether there reall…
HDU 1686 Oulipo / POJ 3461 Oulipo / SCU 2652 Oulipo (字符串匹配,KMP) Description The French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter 'e'. He was a member of the Oulipo group. A quote from the book: Tout avait…
Zynq7000术语详解,不懂啥是PL,PS,APU,SCU?那就进来看看吧     相信大家刚看到Zynq手册的时候,对着那么一大堆缩略语肯定是一头雾水,特转来一篇文章,为大家解惑 摘要:本文介绍与XILINX的EPP平台成员, ZYNQ芯片相关的缩写术语和含义.  与简单翻译术语不同,本文对每个缩写在本行业其他公司的展开含义也略作介绍, 避免混淆. 对术语的技术功能也作简单介绍. 8月份学校放暑假,  大学计划这边紧急的事不多, 因此通常是俺的充电和学习时间. 本月的学习任务嘛, 当然是ZY…
BackGroud Year 2003不知你是否注意到,四川大学每年都会在各宿舍楼里放老鼠药,以解决学生宿舍的老鼠问题. 今年,学校的领导为了更好的展开灭鼠的行动,引进了一项新的技术:SCU(Super Cat Union). 它是通过两只机器猫对宿舍楼的扫描来判断老鼠的所在,然后采取相应的措施. 这下可惹急了我们的FatMouse,它通过努力,终于找到了SCU的一个bug... The Problem 假设两只猫的工作范围各是一个球,猫位于球中心.在三维空间中两个球的相交点构成一个平面(假设在…
题目链接:http://cstest.scu.edu.cn/soj/problem.action?id=4313 判断是不是存在拆图得到新连通分支的点个数是K的倍数 注意一个点所连的边只能被切一条 #include<stdio.h> #include<string.h> #define N 200001 struct node{ int f,t,fn,tn,nex; }edge[N]; int edgenum, head[N]; void addedge(int u, int v)…
Censor frog is now a editor to censor so-called sensitive words (敏感词). She has a long text \(p\). Her job is relatively simple -- just to find the first occurence of sensitive word \(w\) and remove it. frog repeats over and over again. Help her do th…
题目传送门 /* 数学题:当有一个数开根号后是无理数,则No */ #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> #include <vector> #include <iostream> #include <string> #include <map> #include <set> using…
题目传送门 /* 题意:从原点出发,四个方向,碰到一个点向右转,问多少次才能走出,若不能输出-1 模拟:碰到的点横坐标相等或纵坐标相等,然而要先满足碰到点最近, 当没有转向或走到之前走过的点结束循环.dir数组使得代码精简巧妙 对点离原点排序竟然submit failed,别人的代码有毒! */ #include <cstdio> #include <cstring> #include <algorithm> #include <map> #include…
先上题目: D - Discover Time Limit:0MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Submit Status Practice SCU 4117 Description Time Limit: 3000 MS Memory Limit: 65536 K Description GLC has developed an algorithm to map each lattice point in the 2…