- 博客(21)
- 收藏
- 关注
原创 HDU 2202 最大三角形
#include #include #include #include #include using namespace std; const int maxn=50005; struct node{ int x,y; }e[maxn],res[maxn]; int cmp(node a,node b) { if(a.x==b.x)return a.y<b.y;
2014-07-24 11:54:38
611
原创 POJ 2796 Feel Good
#include #include #include using namespace std; #define N 100010 #define ll __int64 struct S{ int startPos; ll h; S(int start=0,ll hh=0){ startPos=start; h=hh; } }stac
2014-07-21 13:02:40
434
原创 POJ 2082 Terrible Sets
#include #include #include using namespace std; #define N 50010 struct S{ int startPos; int w,h; S(int start=0,int ww=0,int hh=0){ startPos=start; w=ww; h=hh; }
2014-07-21 11:13:31
375
原创 acdream Number theory
This time I will give you some straight! Give you a sequence a1, a2, a3...,an, the question is how many pair(ai, aj) that ai and aj is coprime(huzh)? (i
2014-06-15 16:53:30
498
原创 acdream1094 几何
#include #include #include #include using namespace std; #define eps 1e-6 #define pi acos(-1) struct Point{ double x,y; Point(double a=0,double b=0){ x=a,y=b; } Point operator
2014-05-25 14:03:50
494
原创 poj 1928 The Peanu
#include#include #include #include using namespace std; int n,m,t; struct Point{ int x,y; int c; }; bool cmp(Point a,Point b){ return a.c>b.c; } int main(){ int T; cin>>T;
2014-05-24 09:57:37
461
原创 poj2296(二分+2sat)
#include #include #include #include #include #include #include #include #include #include using namespace std; const int maxn = 210; const int maxm = 210*210*5; const int INF = 0x3f3f3f3f;
2014-04-23 13:31:11
402
原创 poj 1753状态压缩水题一发
#include #include using namespace std; int state=(1<<16)-1; int dir[4][2]={0,1,1,0,0,-1,-1,0}; char str1[5][5],str[5][5]; int main(){ for(int i=0;i<4;i++) scanf("%s",str1[i]); int Mi
2014-04-23 13:20:34
447
原创 hdu 4248 A Famous Stone Collector
题目大意:给n堆不同颜色的石头,给定每堆石头的数量,问,能够组成多少串满足: Two patterns are considered different, if and only if they have different number of stones or have different colors on at least one position. dp[i][k]指前i堆石
2013-10-23 21:06:52
557
原创 hdu 1565
题意:给你n*n个数,要你取不相邻的数,取得一个最大值。 状态压缩DP。。 #include #include #include using namespace std; const int M=1<<20; int num,n,Max; int state[100000];//存所有的状态 int map[25][25]; int dp[2][100000];//循环
2013-10-06 13:30:21
667
原创 zoj 1004 Anagrams by Stack
题意:利用堆栈操作,将第一个单词转换成第二个单词 ,i代表入栈,o代表出栈,输出所有的可能,并且要按字典序排序。 dfs模拟堆栈的操作。。。 #include #include #include #include using namespace std; string a,b; //pos源单词的位置,deep目标单词的位置,pop模拟出栈过程,push模拟入栈过程
2013-10-02 16:12:54
464
原创 zoj 1003 Crashing Balloon
模拟。。 因子分解,判断是否有公共的因子。如果有的话,分数低的那个就是赢家;如果没有,分数高的就是赢家。气球一共100个,将得分与数字2-100逐个整出,如果是分解的因子就知道是踩了那哪些气球。 #include #include #include #include #include using namespace std; int f1,f2; void solve(
2013-10-01 16:14:36
486
原创 HDU 4739 Zhuge Liang's Mines
先排序,然后从左下角暴力搜一次。 #include #include #include #include using namespace std; int n,res; int vis[20]; struct node{ int x; int y; }N[20]; int cmp(node a,node b){ if(a.x==b.x) ret
2013-09-30 14:19:09
587
原创 hdu 4740 The Donkey of Gui Zhou
模拟,dfs搜一遍。。。 #include #include #include #define MAXN 1010 using namespace std; int n,f1,f2; int vis1[MAXN][MAXN],vis2[MAXN][MAXN]; int dir[][2]={0,1,1,0,0,-1,-1,0}; void solve(int x1,int y1,
2013-09-30 14:14:57
598
原创 hdu 4738 Caocao's Bridges
#include #include #include #include #include using namespace std; #define N 1005 struct node{ int from,to,next,l; }edge[N*N*2],edge1[2*N*N]; int head[N],tol,toll,n,m,cnt,dfn[N],low[N],visit[N],
2013-09-30 14:00:40
559
原创 hdu 4715 Difference Between Primes
#include #include #define MAXN 2000010 using namespace std; int prim[MAXN],flag[MAXN]; int len; //筛素数 void init(){ int i,j; len=0; for(i=2;i<=2000001;i++){ if(!flag[i]) prim[len++]
2013-09-13 13:38:30
422
原创 Wedding POJ-3648
题意:N对夫妇举行婚礼,对立相坐于矩形桌两边,其中夫妇必须一边只能一人,其中有M对情妇,要求新郎那边不能有情妇,输出新娘这边的情况。 2-sat。 其中建图要注意新郎一定会在。 #include #include #include #include #include #define INF 6010 #define inf 0x0f0f0f0f using n
2013-09-13 11:41:28
513
原创 POJ Tree
点的分质。。 详细见09年漆子超论文。#include #include #include #include #define MAXN 10010 #define INF 1000000000 using namespace std; int n,m,tot,cent,t,res,mi; int head[MAXN],mnum[MAXN],summ[MAXN],vis[MAXN],dis[
2013-09-04 15:58:59
552
原创 hdu Holiday's Accommodation
//tree-dp,这题要注意的是,直接递归会爆内存,所以要手写一个栈来维护 #include #include #include #include #include #include #include #define MAXN 100050 #define inf 1000000000 using namespace std; typedef __int64 LL; int n,st,tot,
2013-09-04 15:50:15
471
原创 hdu Computer
#include #include #include #include #include #define MAXN 10010 using namespace std; int n,tot; int head[MAXN],dis1[MAXN],dis2[MAXN],vismax[MAXN],dp[MAXN];//dis1指最长路,dis2指次长路,dp指除去最长路 struct edge{
2013-09-04 12:55:34
725
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅