随笔分类 - HDU
hdu 4027 Can you answer these queries?
摘要:Can you answer these queries?Time Limit: 4000/2000 MS (Java/Others)Memory Limit: 65768/65768 K (Java/Others)Total Submission(s): 8501Accepted Submissi...
阅读全文
hdu 4022 Bombing
摘要:BombingTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 65768/65768 K (Java/Others)Total Submission(s): 2650Accepted Submission(s): 990Problem Desc...
阅读全文
hdu 4034
摘要:比赛时才发现自己基础算法都忘得光光了,逆向floydi->j经过k点,只要i到j的距离大于或者等于,就把这边标记,实为去掉。。。此时整个图就减一条边 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 #defin...
阅读全文
hdu 1869 六度分离
摘要:floyd 点对点的路径两个人如果认识 则记为1 两个人之间的路径超过7,则为no 1 #include 2 #include 3 #define INF 9999999 4 int d[1000][1000]; 5 int v,e; 6 void init() 7 { 8 int i,j;...
阅读全文
hdu 2159
摘要:beiao 1 #include 2 #include 3 #include 4 using namespace std; 5 #define maxp 102 //经验值 6 #define maxv 102 //种类 7 #define Max(i,j) i > j? i : j 8 int...
阅读全文
hdu 2546 饭卡
摘要:0-1背包问题i = 1,扫所有上限价钱只购买一件物品的最大消费(price[1])i = 2,更新一遍,此时是购买两件物品的最大消费(price[2])以此类推~有n件物品但是只进行到n-1,是因为最大的那件物品留至最后才减价值最高上限为m-5 1 #include 2 #include 3 #i...
阅读全文
hdu 1012 素数判定
摘要:这道题~以前判定prime是一个个去试着整除再去存储,上次弄过欧拉函数那题目之后就知道了,这样会更快捷:1 prime[0] = prime[1] = 1;2 for(int i = 2; i 2 #include 3 using namespace std; 4 #define maxn...
阅读全文
hdu 2098 分拆素数和
摘要:WA了好几发..........原来是我的数组越界了,习惯性定义了prime[maxn] 但是每次都去改写maxn位置!!!!太大意了 要时刻提醒自己不要忘记数组不要越界!下面是AC代码~~~ 1 #include 2 #include 3 using namespace std; 4 #defin...
阅读全文
hdu 1598 find the most comfortable road
摘要:贪心+并查集fighting~~~~~!! 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 #define maxn 300 7 #define INF 0x3fffffff 8 int par[maxn]; ...
阅读全文
hdu 1879 继续畅通工程
摘要:kruskal实现~加油加油加油~\(≧▽≦)/~ 只会做水题这是不行的!! 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 #define maxn 105 7 int par[maxn]; 8 int n,...
阅读全文
hdu 1875 畅通工程再续
摘要:kruskal实现~~ 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 #define maxn 300 7 int par[maxn]; 8 int pos; 9 int n,cnt; 10...
阅读全文
hdu 1863 畅通工程
摘要:kruskal实现~~ 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 #define maxn 760 7 int par[maxn]; 8 int n,m; 9 int len;10 int cnt;11 ...
阅读全文
hdu 2072 单词数
摘要:set的应用 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 int main() 7 { 8 freopen("input.txt","r",stdin); 9 string s,s1;10 ...
阅读全文
hdu 1004 Let the Balloon Rise
摘要:map的应用 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 int main() 7 { 8 freopen("input.txt","r",stdin); 9 mapballoons;10 ...
阅读全文
hdu 1856 More is better
摘要:并查集 简单题 1 #include 2 #include 3 #include 4 #define N 10000005 5 using namespace std; 6 int par[N]; 7 int M[N]; 8 int Find(int x) 9 {10 if(par[x...
阅读全文
hdu 1232
摘要:并查集 入门题 1 #include 2 #include 3 int par[1000]; 4 int Find(int x) 5 { 6 while(par[x] > 0) 7 x = par[x]; 8 return x; 9 }10 void Merge(in...
阅读全文
hdu 1226 超级密码
摘要:超级密码Time Limit: 20000/10000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Problem DescriptionIgnatius花了一个星期的时间终于找到了传说中的宝藏,宝藏被放在一个房间里,房间的门用密...
阅读全文
hdu 1312 Red and Black
摘要:集训第一场 B题dfs简单题 做完这题就撤,回来再继续做吧= = 水手加油~ 1 #include 2 #include 3 4 int Count; 5 int to[4][2] = {{-1,0},{1,0},{0,1},{0,-1}}; 6 int row,col; 7 char room[...
阅读全文
hdu 1241 Oil Deposits
摘要:集训第一场,A题dfs简单题之前看过dfs,没实现过,第一次实现出来O(∩_∩)O~水手加油~ 1 #include 2 #include 3 using namespace std; 4 int row,col; 5 char oil[1000][1000]; 6 int to[8][2]={{-...
阅读全文
hdu 1.3.4 shǎ崽 OrOrOrOrz
摘要:简单的排序,注意输出即可#include #include using namespace std;int main(){ int a[10001]; int n,i; //int t = 0; while(cin>>n) { //if(t)cout>a[...
阅读全文
浙公网安备 33010602011771号