随笔分类 -  HDUACM

一些acm题目解答
摘要:#include <stdio.h> #include <string.h> #define MAXN 120005 int main() { int num[7]; int T = 0; while (scanf("%d %d %d %d %d %d", &num[1], &num[2], &nu 阅读全文
posted @ 2017-01-20 22:11 王坤1993 阅读(193) 评论(0) 推荐(0)
摘要:#include<iostream> #include<string> using namespace std; int const N = 4; int map[N] = {2,3,5,7}; int findMin(int arr[], bool flag[], int len) { int m 阅读全文
posted @ 2017-01-20 22:08 王坤1993 阅读(119) 评论(0) 推荐(0)
摘要:#include <iostream> #include <string> #include <cstring> using namespace std; int dir[4][2]={{0,-1},{0,1},{-1,0},{1,0}}; int mat[20][20],tar[20][20],t 阅读全文
posted @ 2017-01-20 00:22 王坤1993 阅读(276) 评论(0) 推荐(0)
摘要:#include <cstdio> void main(){ double length; double l[300]; l[1] = 1.0/2; int i; for (i = 2;; ++i) { l[i] = l[i-1] + 1.0/(i+1); if (l[i] >= 5.20) bre 阅读全文
posted @ 2017-01-19 00:06 王坤1993 阅读(200) 评论(0) 推荐(0)
摘要:#include<iostream> #include<iomanip> #include<cstdio> #include<cstring> #include<algorithm> #include<cstdlib> #include<cmath> #include<map> #include<s 阅读全文
posted @ 2017-01-18 23:49 王坤1993 阅读(232) 评论(0) 推荐(0)
摘要:/* 【题意】 给定一棵树,标记一节点,则与该节点所连的边都被标记,问最少需要标记多少个节点使得所有边都被标记; 或者说给定一个树型城堡,在交叉路口放一个士兵,则与该路口相连的路都被守住, 问最少需要派遣多少个士兵来守住这个城堡 dp[father].yes= ( min(dp[child].yes 阅读全文
posted @ 2017-01-18 22:13 王坤1993 阅读(153) 评论(0) 推荐(0)
摘要:#include<iostream> #include<algorithm> using namespace std; bool cmp(int a,int b) { return a>b; //从大到小排序 } int a[30],m; char s[1005]; int huffman() { 阅读全文
posted @ 2017-01-18 22:11 王坤1993 阅读(164) 评论(0) 推荐(0)
摘要:#include <iostream>#include<algorithm>#include<queue>#include<stack>#include<cmath>#include<string.h>#include<stdio.h>#include<stdlib.h>using namespac 阅读全文
posted @ 2017-01-18 22:08 王坤1993 阅读(102) 评论(0) 推荐(0)
摘要:#include<iostream> #include<algorithm> using namespace std; struct SIZE { int l; int w; }sticks[5005]; int flag[5005]; bool cmp(const SIZE &a,const SI 阅读全文
posted @ 2017-01-18 00:14 王坤1993 阅读(132) 评论(0) 推荐(0)
摘要:#include <cstdio> #include <algorithm> using namespace std; #define SIZE 205 struct Data_Type { int from, to; bool flag; }moving[SIZE]; bool Cmp(const 阅读全文
posted @ 2017-01-16 23:19 王坤1993 阅读(193) 评论(0) 推荐(0)
摘要:#include<stdio.h>int main(){ int n,u,d; while(scanf("%d%d%d",&n,&u,&d),n) { int t=(n-u)/(u-d); if(t*(u-d)<(n-u)) t++; t*=2; t++; printf("%d\n",t); } r 阅读全文
posted @ 2017-01-16 23:17 王坤1993 阅读(149) 评论(0) 推荐(0)
摘要:#include<stdio.h>#include<string.h>#include<iostream>using namespace std;int main(){ //freopen("test.in","r",stdin); //freopen("test.out","w",stdout); 阅读全文
posted @ 2017-01-16 23:16 王坤1993 阅读(102) 评论(0) 推荐(0)
摘要:#include<stdio.h>#include<string>#include<iostream>using namespace std; //高精度加法//只能是两个正数相加string add(string str1,string str2)//高精度加法{ string str; int 阅读全文
posted @ 2017-01-16 23:14 王坤1993 阅读(133) 评论(0) 推荐(0)
摘要:#include<iostream> #include<cmath> using namespace std; int main() { int T,t=0,m,n; cin>>T; while(T--) { cin>>m>>n; cout<<"Scenario #"<<++t<<":"<<endl 阅读全文
posted @ 2017-01-16 20:37 王坤1993 阅读(147) 评论(0) 推荐(0)
摘要:#include<iostream> using namespace std; int count = 0, n = 0; //判断该ch[x][y]是否可以放置 bool isOk(char **ch, int x, int y){ int i; //向上检索 for (i = x - 1; i 阅读全文
posted @ 2017-01-15 21:55 王坤1993 阅读(111) 评论(0) 推荐(0)
摘要:#include <cstdio> #include <cstring> #include <queue> using namespace std; const int maxn=55; int n,m,t,x1,y1,x2,y2; struct node { int x,y; int zb; in 阅读全文
posted @ 2017-01-15 21:54 王坤1993 阅读(273) 评论(0) 推荐(0)
摘要:#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>#include<queue>#include<vector>#include<cmath>#include<map>#include<string>#defi 阅读全文
posted @ 2017-01-15 21:31 王坤1993 阅读(245) 评论(0) 推荐(0)
摘要:#include"stdio.h" #include"stdlib.h" #include"string.h" #define N 10000 int a[N]; int main() { int i,j,n,len; while(scanf("%d",&n)!=-1) { memset(a,0,s 阅读全文
posted @ 2017-01-15 21:25 王坤1993 阅读(101) 评论(0) 推荐(0)
摘要:#include <iostream> #include <string> using namespace std; const int SIZE = 1001; const int BASE = 10; string result[SIZE]; string two("2"); void init 阅读全文
posted @ 2017-01-15 21:22 王坤1993 阅读(298) 评论(0) 推荐(0)
摘要:#include<stdio.h>#include<stdlib.h>int a[100];int cmp(const void *a,const void *b){ return *(int *)a-*(int *)b;} int main(){ int T,n,i; scanf("%d",&T) 阅读全文
posted @ 2017-01-14 23:44 王坤1993 阅读(230) 评论(0) 推荐(0)