ZOJ 2048 highways】的更多相关文章

题目 比我想象地要容易很多..一开始想得太复杂了,本来想试一下kruskal算法的,嫌麻烦..还是用了之前1203的prim算法...以为要注意这道题的输出顺序,结果不用,直接输出就可以了,就是注意一下空行的输出就行了 //#include "stdafx.h" #include <iostream> #include "stdio.h" #include <math.h> using namespace std; int town[750]…
http://poj.org/problem?id=1751 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2048 题目大意: 给你n个点的坐标,并且m个点之间已经建立起连接,让你输出剩下的MST的连接点. 两题其实一样.就输入一点点不同. 因为题目采用Special Judge故水题一题. POJ: #include<cstdio> #include<cmath> #include<algorit…
Highways Time Limit: 5 Seconds      Memory Limit: 32768 KB      Special Judge The island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has a very poor system of public highways. The Flatopian government is aware of this problem and ha…
Easy 2048 Again Time Limit: 2 Seconds      Memory Limit: 65536 KB Dark_sun knows that on a single-track road (which means once he passed this area, he cannot come back again), there are some underground treasures on each area of the road which has th…
链接:problemId=5334">http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5334 题意:一个长度为500的数列.每一个数可能是2,4,8.16.从第一个開始取,每一个数能够选择取或者不取.假设取了x.这个数和之前的数假设同样.那么两个数会合并成为2*x而且收起来,假设不同就把这个数收起来. 思路:比方像要凑成2048,必须拥有一个1024,512,256,128,64,32,16,8,4,2中某段从1024…
zoj 上次的月赛题,相当牛的题目啊,根本想不到是状态压缩好吧 有个预先要知道的,即500个16相加那也是不会超过8192,即,合并最多合并到4096,只有2的12次方 所以用状态压缩表示前面有的序列组合,找到了符合的,就往上累加合并生成新状态,否则就添加到前面的状态的后面构成新状态,因为每一个的状态都由前一个所得,用滚动数组即可 #include <iostream> #include <cstdio> #include <cstring> #include <…
ZOJ Monthly, August 2014 E题 ZOJ月赛 2014年8月 E题 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5334 Easy 2048 Again Time Limit: 2 Seconds      Memory Limit: 65536 KB Dark_sun knows that on a single-track road (which means once he passed this…
传送门: Detect the Virus                                                                                                                                                                                                                                     …
转自——http://blog.csdn.net/qwe20060514/article/details/8112550 =============================以下是最小生成树+并查集======================================[HDU]1213   How Many Tables   基础并查集★1272   小希的迷宫   基础并查集★1325&&poj1308  Is It A Tree?   基础并查集★1856   More i…
Detect the Virus Time Limit: 2 Seconds      Memory Limit: 65536 KB One day, Nobita found that his computer is extremely slow. After several hours' work, he finally found that it was a virus that made his poor computer slow and the virus was activated…