随笔分类 -  学习之路

摘要:functionstd::setprecision<iomanip>/*unspecified*/ setprecision (int n);Set decimal precisionSets the decimal precision to be used to format floating-point values on output operations.Behaves as if member precision were called withn as argument on the stream on which it is inserted/extracted as 阅读全文
posted @ 2013-04-20 20:56 bo_jwolf 阅读(1653) 评论(0) 推荐(0)
摘要:Robberies挺有意思的题目,需要点转化。01背包:每个物品代价是每个银行钱的数目,物品的价值是在该银行不被抓的概率 (1-被抓概率),背包容量是所有银行钱的总和。01背包求dp[i]表示获得i的钱不被抓的最大概率。最后从大到小枚举出 dp[i]>=(1-P)这个i就是答案了。关键在于理解题目意思。。。另外需要活学活用,01背包中不可以生搬硬套,这里变成*weight;// File Name: hdu2955.cpp // Author: rudolf // Created Time: 2013年04月20日 星期六 19时34分14秒 #include<vector> 阅读全文
posted @ 2013-04-20 19:44 bo_jwolf 阅读(157) 评论(0) 推荐(0)
摘要:饭卡打啵固态思维,转换成01背包问题,学习人家dp的排版先01背包算出用m-5元可以买到最贵的菜,然后就会一次买最贵的。// File Name: hdu2546.cpp // Author: rudolf // Created Time: 2013年04月20日 星期六 18时51分53秒 #include<iostream> #include<algorithm> #include<string.h> using namespace std; const int maxn=1010; int dp[maxn]; int value[maxn],weigh 阅读全文
posted @ 2013-04-20 19:03 bo_jwolf 阅读(117) 评论(0) 推荐(0)
摘要:Charm Bracelet01背包,打啵固态,背包重来// File Name: poj3624.cpp // Author: rudolf // Created Time: 2013年04月20日 星期六 18时17分21秒 #include<vector> #include<list> #include<map> #include<set> #include<deque> #include<stack> #include<bitset> #include<algorithm> #include 阅读全文
posted @ 2013-04-20 18:19 bo_jwolf 阅读(205) 评论(0) 推荐(0)
摘要:Doing Homework again// File Name: hdu1789.cpp // Author: rudolf // Created Time: 2013年04月20日 星期六 15时52分23秒 #include<vector> #include<list> #include<map> #include<set> #include<deque> #include<stack> #include<bitset> #include<algorithm> #include<func 阅读全文
posted @ 2013-04-20 15:58 bo_jwolf 阅读(157) 评论(0) 推荐(0)
摘要:ACM HDU 1172 猜数字 // File Name: hdu1172.cpp // Author: rudolf // Created Time: 2013年04月20日 星期六 14时58分47秒 #include<vector> #include<list> #include<map> #include<set> #include<deque> #include<stack> #include<bitset> #include<algorithm> #include<functio 阅读全文
posted @ 2013-04-20 15:08 bo_jwolf 阅读(210) 评论(0) 推荐(0)
摘要:G -QS Network读懂题意,就都是是水题#include <stdio.h> #include <string.h> #include <stdlib.h> #include <math.h> #include <ctype.h> #include <algorithm> #define N 1001 const int maxn=(N*N-N) / 2 + 1; using namespace std; struct edge { int x, y, value; }edge[maxn]; int n, len, 阅读全文
posted @ 2013-04-20 14:16 bo_jwolf 阅读(173) 评论(0) 推荐(0)
摘要:I -Arctic Network#include<iostream> #include<algorithm> using namespace std; const int maxn=6000; int n; int mapp[maxn][maxn]; struct node { int x,y,value; }edge[maxn]; int fa[maxn]; bool cmp(const node a,const node b) { return a.value<b.value; } int find(int x) { return x==fa[x]?x:fi 阅读全文
posted @ 2013-04-19 20:57 bo_jwolf 阅读(172) 评论(0) 推荐(0)
摘要:B -Network这个题目真坑,用G++居然TLE,用c++ 直接A了,还好在poj直接过了,否则,找错误不得找死啊!!!!#include<iostream> #include<algorithm> using namespace std; const int maxn=15001; struct node { int x,y,value; }edge[maxn]; int fa[maxn]; int find(int x) { return x==fa[x]?x:find(fa[x]); } bool cmp(const node a,const node b) 阅读全文
posted @ 2013-04-19 15:23 bo_jwolf 阅读(160) 评论(0) 推荐(0)
摘要:J -Agri-Net#include<iostream> #include<algorithm> using namespace std; const int maxn=101; struct node { int x,y,value; }edge[maxn*maxn]; int fa[maxn]; int k; int find(int x) { return x==fa[x]?x:find(fa[x]); } bool cmp(const node a,const node b) { return a.value<b.value; } int main() 阅读全文
posted @ 2013-04-19 14:37 bo_jwolf 阅读(165) 评论(0) 推荐(0)
摘要:E - Networking#include<iostream> #include<algorithm> using namespace std; const int maxn=2000; struct node { int x,y,value; int flag; }edge[maxn]; int fa[maxn]; int find(int x) { return x==fa[x]?x:find(fa[x]); } bool cmp(node a,node b) { return a.value<b.value; } int main() { int m,n, 阅读全文
posted @ 2013-04-19 14:04 bo_jwolf 阅读(177) 评论(0) 推荐(0)
摘要:poj 3207 http://blog.sina.com.cn/s/blog_64675f540100k13v.htmlpoj 3678 http://blog.sina.com.cn/s/blog_64675f540100k15b.htmlpoj 3683 http://blog.sina.com.cn/s/blog_64675f540100k1cd.htmlpoj 3648 http://blog.sina.com.cn/s/blog_64675f540100k1g9.htmlpoj 2723 http://blog.sina.com.cn/s/blog_64675f540100k2rh 阅读全文
posted @ 2013-04-18 23:02 bo_jwolf 阅读(140) 评论(0) 推荐(0)
摘要:第一次完整的写出图论中最小路径中常使用的Kruscal和Prim两种算法,呵呵。。。不过我还是比较kruscal(代码比较短,还容易记)C -Jungle Roads// File Name: tulun_jungle.cpp // Author: rudolf // Created Time: 2013年04月18日 星期四 20时57分16秒 //kruscal #include<vector> #include<list> #include<map> #include<set> #include<deque> #include& 阅读全文
posted @ 2013-04-18 22:52 bo_jwolf 阅读(145) 评论(0) 推荐(0)
摘要:这是我们分组后Dots_lzl小组第一次参加组队赛,也是很开心的一次,虽然只A了2道题目(本来应该是三道的,已经AC了,但是却说时间到了,居然说是因为比赛提前开始了几分钟,我们就是在最后几分钟A的呀,别的组WA20多次,我们5次过的题目,他居然封榜了),以下仅有C,E,K是我们组做的B -Bit Magic本题很简单,明显的2-SAT的模版题。 这题是2-SAT。只不过模板写错了一点,多加了个分号,导致样例一直出不来。幸好调试之后发现, 修改一下,交上去1A,爽~~~~此题是做得最顺利的了。 现场赛的时候内存真的是无穷大啊,直接做31*500*2=31000个点的2-SAT就AC了。但是比赛. 阅读全文
posted @ 2013-04-18 13:24 bo_jwolf 阅读(153) 评论(0) 推荐(0)
摘要:C. Learning Languages今天恰好学了图论中的最小生成树和prim还有克鲁丝卡尔,其中提到了并查集,下面是CF上的一个例子,恰好使用了并查集,这个是别人的代码,当时并不知道这个是什么意思,怎么用,现在看来,任何算法都需要先学习后才能看懂人家的代码,以后才能学会使用。其中fa[]数组起到的作用就是连接两个集合;// File Name: 170c.cpp // Author: rudolf // Created Time: 2013年03月04日 星期一 16:19:34 #include<vector> #include<list> #include&l 阅读全文
posted @ 2013-04-16 19:21 bo_jwolf 阅读(182) 评论(0) 推荐(0)
摘要:hdu 2131 View Code 复制代码 #include<stdio.h> #include<string.h> int main() { char ch[2],s[210]; while(scanf("%s %s",ch,s)!=EOF) { char x = ch[0]; int len = strlen(s); int cnt = 0; if( x >= 'A' && x <= 'Z' ) { for(int i ... 阅读全文
posted @ 2013-04-16 16:26 bo_jwolf 阅读(167) 评论(0) 推荐(0)