摘要: 这道题仍然是两个月之前做过,当时是RE,但不知为何当时没有考虑到把数组开的大一点就可以了。今天拿出代码将1024改为102400,瞬间AC。 网上搜了下竟然没有这个题的题解。我的做法还是很普通的做法,就是使用了STL的几个工具而已,比如vector、string、erase、remove、str... 阅读全文
posted @ 2015-02-03 19:53 Popco 阅读(172) 评论(0) 推荐(0) 编辑
摘要: 两个月前就搞这道题,昨天翻出来直接修改的当时的超时代码,经历了多种错误,最后终于还是AC了。 这道题还是挺好的一道题,需要正反两次BFS,需要加各种防超时的判断。实际上还是考差对问题的理解,什么时候应该剪枝,什么地方不必重复判断。 第一次反着BFS,找到各点到终点的最短距离。第二次正着BFS,... 阅读全文
posted @ 2015-02-03 15:05 Popco 阅读(226) 评论(0) 推荐(0) 编辑
摘要: 这题本来想按照算法竞赛入门经典上的DFS来做,但是无奈这个题有点特殊,有重边的情况,所以学习了另外一种复杂度相同切更好理解的一种算法。 #include #include #include #include #define maxn 512using namespace std;int n, m... 阅读全文
posted @ 2015-02-03 12:21 Popco 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 这道题题意比较好理解,但需要一些关于欧拉道路的思考。 刚开始考虑用并查集做,每个集(或者说每条链)有可能是环状,或者有多个奇点,这就需要多个入口和出口,需要统计,用并查集并不太好实现。然后考虑DFS的做法,需要计算每个节点的度数,统计每条链的奇点个数,并且注意每条连至少需要一个入口和一个出口,最... 阅读全文
posted @ 2015-02-02 11:46 Popco 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 今天看到一位学长写的博客,很受启发。要抛却功利心,形成自己的思维,不要老看题解,要追求多种方法,要优化自己的程序直到不能再优化,关注自己程序的运行时间和内存占用的排名。还有写题解不能只写两三句话就完事,要不然还不如不写。 这道RAID的题目,首先是位运算,实际上我的思路是看样例猜出来的,奇校验所... 阅读全文
posted @ 2015-02-01 15:47 Popco 阅读(386) 评论(0) 推荐(0) 编辑
摘要: 这个题,三个月前写了一次,当时写道200行的时候,就感觉恶心了,当时感觉再写100行也完不成。 今天拿出这题来重写了,尽量精简代码,结果没想到90行就AC了。精简代码的好处之一便是方便调试,因为细节太多了,把很多相似的内容放在函数中就好了。 看似四个棋子的走法不同,实则有一个共同点:都需要判断棋... 阅读全文
posted @ 2015-01-31 14:12 Popco 阅读(153) 评论(0) 推荐(0) 编辑
摘要: There is a mysterious planet called Yaen, whose space is 2-dimensional. There are many beautiful stones on the planet, and the Yaen people love to ... 阅读全文
posted @ 2015-01-29 16:03 Popco 阅读(198) 评论(0) 推荐(0) 编辑
摘要: A mobile is a type of kinetic sculpture constructed to take advantage of the principle of equilibrium. It consists of a number of rods, from which ... 阅读全文
posted @ 2015-01-28 00:14 Popco 阅读(185) 评论(0) 推荐(0) 编辑
摘要: Play on Words Some of the secret doors contain a very interesting word puzzle. The team of archaeologists has to solve it to open that doors. Becaus... 阅读全文
posted @ 2015-01-27 11:53 Popco 阅读(139) 评论(0) 推荐(0) 编辑
摘要: Concurrency Simulator Programs executed concurrently on a uniprocessor system appear to be executed at the same time, but in reality th... 阅读全文
posted @ 2015-01-26 21:49 Popco 阅读(206) 评论(0) 推荐(0) 编辑
摘要: 最害怕这种下棋的题了,情况特别多,考差细节特别多,当时没做,现在翻过头来再看一下,顺便复习一下基础。 这道题要注意格式,输出统计黑白棋子数的时候,数要占两位。其他都是普通的思路,顺着题目要求即可。 寒假刚刚开始,是提高自我的好时间,希望自己能利用起来。 #include using name... 阅读全文
posted @ 2015-01-26 10:37 Popco 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 矩形回旋 Description 有一个由 n*m(n是行数,m为列数) 的方格组成的矩形阵列。 现在从左上角开始顺时针旋转走动,遇到矩形边框或者遇到已经过的方格就转向继续,直到走完所有方格。求最后结束点的坐标(横坐标位置从1到m,纵坐标从1到n)。 Input 第一行输入一个数T代... 阅读全文
posted @ 2015-01-20 10:24 Popco 阅读(138) 评论(0) 推荐(0) 编辑
摘要: //本题用cin超时啊,要用scanf#define _CRT_SECURE_NO_WARNINGS#include #include #include #include #include #include using namespace std;const int maxn = 100000... 阅读全文
posted @ 2015-01-19 12:32 Popco 阅读(124) 评论(0) 推荐(0) 编辑
摘要: Problem Description Today is Ignatius' birthday. He invites a lot of friends. Now it's dinner time. Ignatius wants to know how many tables he need... 阅读全文
posted @ 2015-01-19 11:58 Popco 阅读(118) 评论(0) 推荐(0) 编辑
摘要: Problem Description 某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路? Inpu... 阅读全文
posted @ 2015-01-19 11:26 Popco 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 相等的尾数 Time Limit: 1 Sec Memory Limit: 128 MB Description 我们假设有一个整数K,需要你寻找两个自然数M和N(M>N),使得K^M和K^N(1000 using namespace std; int vis[1024]; int m... 阅读全文
posted @ 2015-01-12 21:28 Popco 阅读(170) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include using namespace std;long long int table[1024000];void init(void){ for(long long int i=1; i b) swap(a, b); ... 阅读全文
posted @ 2015-01-05 23:33 Popco 阅读(133) 评论(0) 推荐(0) 编辑
摘要: Tempter of the Bone Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 75924 Accepted Subm... 阅读全文
posted @ 2015-01-05 23:07 Popco 阅读(217) 评论(0) 推荐(0) 编辑
摘要: Fibonacci Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 9776 Accepted: 6964 Description In the Fibonacci integer seque... 阅读全文
posted @ 2015-01-03 09:00 Popco 阅读(173) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std;//一般方法int pow1(int a, int b){ int t = a; b--; while(b--) a *= t; return a;}//普通快速幂int pow2(int a,int... 阅读全文
posted @ 2015-01-02 21:47 Popco 阅读(158) 评论(0) 推荐(0) 编辑