摘要: 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 阅读(1543) 评论(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 阅读(151) 评论(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 阅读(114) 评论(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 阅读(197) 评论(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 阅读(154) 评论(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 阅读(197) 评论(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 阅读(164) 评论(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 阅读(165) 评论(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 阅读(151) 评论(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 阅读(156) 评论(0) 推荐(0) 编辑