摘要:
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 阅读全文
摘要:
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> 阅读全文
摘要:
饭卡打啵固态思维,转换成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 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
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, 阅读全文