随笔分类 -  POJ

摘要:来源:http://poj.org/problem?id=1860 题目的大意,就是要通过多次交易,使得回到开始节点时的钱数增加。 类似于寻找负权回路,但是这里要走回到开始节点。 而对于负权回路,可以用bell-manford或者SPFA,这里用了SPFA。 在SPFA时,当开始节点的钱数>原始钱数,我们就可以退出SPFA,直接输出了。 对于原始的SPFA,这里的relax操作要改... 阅读全文
posted @ 2013-03-01 16:25 ay27 阅读(178) 评论(0) 推荐(0) 编辑
摘要:来源:http://poj.org/problem?id=1008这题没什么的,先算出总的天数,再算出另一种日历的表示就是了,没什么技巧可言。需要注意的是一个特殊的数据:4. uayet 259 ,应输出13 ahau 364基本上样例过了,再把上面的特殊数据过了就行了。#include <iostream>#include <cstdio>#include <string>#include <cstring>using namespace std;const char hmonth[19][10] = {"pop", &qu 阅读全文
posted @ 2013-02-24 10:47 ay27 阅读(257) 评论(0) 推荐(0) 编辑
摘要:哎,这是手贱了,用java写一点都不爽,可能是我不会用java吧T_T。 这题由于数据范围小,水水就过了。 import java.util.*;public class Main { public static void main(String[] args) { Astruct[] s = new Astruct[105]; Scan... 阅读全文
posted @ 2013-02-23 22:06 ay27 阅读(155) 评论(0) 推荐(0) 编辑
摘要:手痒了用java A了这题。 import java.util.*;public class Main{ public static void main(String[] args) { Scanner in = new Scanner(System.in); int count = 0; int p = in.nextInt(); ... 阅读全文
posted @ 2013-02-23 21:59 ay27 阅读(139) 评论(0) 推荐(0) 编辑
摘要:来源:http://poj.org/problem?id=1005 怎么POJ前面的题都那么水= = #include <iostream>#include <cstdio>#include <cmath>using namespace std;#define pi 3.1415926int main(){ int N; cin>>N; for (int Ncase=1... 阅读全文
posted @ 2012-12-12 09:20 ay27 阅读(118) 评论(0) 推荐(0) 编辑
摘要:来源:http://poj.org/problem?id=1004 唉,还有什么好说的,如此水题都让我等遇上了 #include <cstdio>using namespace std;int main(){ double sum=0.0,x; for (int i=1;i<=12;i++) { scanf("%lf",&x); sum+=x... 阅读全文
posted @ 2012-12-12 08:58 ay27 阅读(88) 评论(0) 推荐(0) 编辑
摘要:来源:http://poj.org/problem?id=1002&lang=zh-CN 这题用C++的string来写真的很蛋疼,效率低不说,输入输出真的麻烦。由此看出,C++的STL效率不行,不过除非是那种特别卡时的题,一般STL还是不错的。 这是C++的代码: #include <iostream>#include <cstdio>#include <cstring>#inclu... 阅读全文
posted @ 2012-12-11 18:03 ay27 阅读(166) 评论(0) 推荐(0) 编辑
摘要:来源:http://poj.org/problem?id=1003 这题真的是意外的简单啊,看清楚了数据规模后已经没什么疑问了,水水的过了。 提交的时候还是有点忐忑啊,怎么会有这么水的题= = 我这代码居然用了196K内存,真不知道那些大神怎么可以做到0K秒杀,难道他们不使用变量= = #include <cstdio>using namespace std;int main(){ ... 阅读全文
posted @ 2012-12-11 16:51 ay27 阅读(97) 评论(0) 推荐(0) 编辑
摘要:来源:http://poj.org/problem?id=1001&lang=zh-CN 这题没什么算法可言,主要是各种情况的处理。 思路:先忽略小数点,算完后输出时在适当的位置输出一个小数点就行了,完全按照高精度乘单精度的方法。至于小数点的输出,因为每乘一次带小数点的数,小数位数相加就是了。 给出几种特殊情况: 25 2 25.0 2 0.1 ... 阅读全文
posted @ 2012-12-11 13:02 ay27 阅读(134) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示