摘要: 卡特兰数*阶乘就是答案 第一次用java。。高精度写起来好快。。。。不过代码比较丑。。import java.math.BigInteger;import java.util.Scanner; public class Main{ public static void main(St... 阅读全文
posted @ 2015-05-04 16:15 Fighting_Heart 阅读(168) 评论(0) 推荐(0) 编辑
摘要: 算了前三项.....发现是个大水题。。。#includeint main(){ int n; while (~scanf("%d", &n)) { double k = 1.0*n; printf("%lf\n", k+1); } retur... 阅读全文
posted @ 2015-05-03 19:26 Fighting_Heart 阅读(158) 评论(0) 推荐(0) 编辑
摘要: 给四个数 问能不能算出24点。。。我的方法比较烂。。。920ms 差点TLE。应该有更好的方法。#include#include#include#includeusing namespace std;double a[5], ff[5], n;double rt[30][5], yy[5];int ... 阅读全文
posted @ 2015-05-03 16:20 Fighting_Heart 阅读(231) 评论(0) 推荐(0) 编辑
摘要: 并查集。从后往前加边。#include#include#include#includeusing namespace std;const int maxn = 1000000 + 10;int father[maxn], u[maxn], v[maxn], Q, q[maxn], ans[maxn]... 阅读全文
posted @ 2015-05-03 16:17 Fighting_Heart 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 字典树。建树的过程中,一边建树一边判断有没有重复前缀的。#include#include#include#includeusing namespace std;char s[1000]; int i, j, summ;struct nn{ int tot, ling, yi; }dt[50000];... 阅读全文
posted @ 2015-05-03 08:18 Fighting_Heart 阅读(312) 评论(0) 推荐(0) 编辑
摘要: 数学题目。折腾了一天,这种方法不是最好的,不过按照自己的第一直觉的方法AC还是很开心的。#include#include#include#includeusing namespace std;struct abc{ int start, end;}dt[5000000];bool cmp(co... 阅读全文
posted @ 2015-05-02 18:45 Fighting_Heart 阅读(183) 评论(0) 推荐(0) 编辑
摘要: 对于每个输入的站点求出所有点到这个站点的最短路。用anss数组存下来,然后就可以用anss数组求出答案了。题目分析清楚了 还是比较水的,折腾了一早上。。#include#include#include#include#include#includeusing namespace std;struct... 阅读全文
posted @ 2015-05-01 09:34 Fighting_Heart 阅读(152) 评论(0) 推荐(0) 编辑
摘要: BFS..第一次使用C++ STL的队列来写广搜。#include#include#include#include#includeusing namespace std;const int maxn = 222;struct Point{ int time, x, y; };queue Q;char... 阅读全文
posted @ 2015-04-30 08:51 Fighting_Heart 阅读(156) 评论(0) 推荐(0) 编辑
摘要: 简单的Havel-Hakimi定理(建图)的应用。#include#include#include#includeusing namespace std;const int maxn = 15;int ee[maxn][maxn];struct abc{ int f, node; }dt[maxn]... 阅读全文
posted @ 2015-04-29 21:27 Fighting_Heart 阅读(134) 评论(0) 推荐(0) 编辑
摘要: BFS注意字典序的问题。WA了好多发。#include#include#include#include#includeusing namespace std;const int maxn = 70;int n, cost[maxn][maxn],bb[maxn], ji[maxn];struct a... 阅读全文
posted @ 2015-04-28 23:04 Fighting_Heart 阅读(184) 评论(0) 推荐(0) 编辑
摘要: BFS.....#include#include#include#include#includeusing namespace std;const int maxn = 1111;vectorabc[maxn];int ji[maxn], tt[maxn][maxn], yy[maxn];struc... 阅读全文
posted @ 2015-04-28 21:15 Fighting_Heart 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 写了一下午的dijkstra。突然发现我写的根本不是dijkstra。。。。是没优化过的BFS....... 阅读全文
posted @ 2015-04-28 19:38 Fighting_Heart 阅读(166) 评论(0) 推荐(0) 编辑
摘要: SPFA#include#include#include#include#includeusing namespace std;const int maxn = 222;int k[maxn], ji[maxn];vector abc[maxn];struct aaa{int node, tot;}... 阅读全文
posted @ 2015-04-28 18:59 Fighting_Heart 阅读(118) 评论(0) 推荐(0) 编辑
摘要: SPFA#include#include#include#include#includeusing namespace std;const int maxn = 1111;int tt[maxn][maxn], ji[maxn], yy[maxn];vectorabc[maxn];struct qw... 阅读全文
posted @ 2015-04-28 16:21 Fighting_Heart 阅读(140) 评论(0) 推荐(0) 编辑
摘要: SPFA#include#include#include#include#includeusing namespace std;const int maxn = 2222;vectorabc[maxn];int s[maxn][maxn];int js[maxn];struct aaa{ in... 阅读全文
posted @ 2015-04-28 15:26 Fighting_Heart 阅读(117) 评论(0) 推荐(0) 编辑
摘要: SPFA#include#include#include#include#includeusing namespace std;const int maxn = 2222;vectorabc[maxn];int s[maxn][maxn];int js[maxn];struct aaa{ in... 阅读全文
posted @ 2015-04-28 14:48 Fighting_Heart 阅读(125) 评论(0) 推荐(0) 编辑
摘要: 认真的开始学习图论......必定会碰壁的,但是还是要坚持下来!!! 阅读全文
posted @ 2015-04-27 15:48 Fighting_Heart 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 最小生成树,我用的是并查集+贪心的写法。#include#include#include#includeusing namespace std;const int maxn = 111;int c[maxn][maxn];int father[maxn];int flag[maxn];struct ... 阅读全文
posted @ 2015-04-23 09:38 Fighting_Heart 阅读(144) 评论(0) 推荐(0) 编辑
摘要: 简单的模拟题,类似于高精度加法运算。理解题意即可。#include#include#include#includeusing namespace std;const int maxn = 111;char s[maxn];char ji[maxn];int gg[maxn];void RevStr(... 阅读全文
posted @ 2015-04-22 21:37 Fighting_Heart 阅读(168) 评论(0) 推荐(0) 编辑
摘要: 水题,找误差范围之内9最多的时间,如果有多个,选择误差最小的一个,如果还有多个,选择字典序最小的一个。同一个时间可以有不同的表示方法,例如60:15也可以表示为59:75。#include#include#include#includeusing namespace std;int main(){ ... 阅读全文
posted @ 2015-04-22 17:22 Fighting_Heart 阅读(146) 评论(0) 推荐(0) 编辑