- 博客(21)
- 收藏
- 关注
原创 HDU 1534 Schedule Problem
差分约束+spfa+判断是否存在正环#include#include#include#include#include#include#include#includeconst int maxn = 1000010;const int inf = 0xffffff;struct Edge{ int u,v,w;}e[maxn];int d[maxn],nex
2012-08-29 00:39:35 385
原创 HDU 1384 Intervals
差分约束。。spfa求最长路#include#include#include#include#include#include#include#includeconst int maxn = 50010;const int inf = 0xffffff;struct Edge{ int u,v,w;}e[maxn*4];int d[maxn],next[
2012-08-28 22:54:58 297
原创 HDU 1535 Invitation Cards
Dijkstra+优先队列+反向建图+邻接表#include#include#include#include#include#include#include#includeconst int maxn = 1000010;const int inf = 0xffffff;struct Edge{ int u,v,w;}e[maxn];int d[max
2012-08-28 00:45:14 332
原创 HDU 1217 Arbitrage
Floyd#include#include#include#include#include#include#include#includeconst int maxn = 30;const int maxm = 1010;double d[maxn][maxn];using namespace std;int main(){ int n,m,i,c
2012-08-27 23:53:28 191
原创 HDU 1874 畅通工程续
无向图最短路,邻接表+优先队列#include#include#include#include#include#include#includeconst int maxn = 210;const int maxm = 1010;const int inf = 0xfffffff;int v[maxm*2],u[maxm*2],w[maxm*2],d[maxn],ne
2012-08-27 23:00:43 251
原创 POJ 1971 Parallelogram Counting
4485ms,擦边球?。。。。下面还有一份优化版代码。。563ms#include#include#include#include#includeconst long long maxsize = 0x1fffff;const int maxn = 1010;using namespace std;struct Point{ int x,y;}p[maxn]
2012-08-26 22:23:58 326
原创 HDU 1045 Fire Net
亮瞎。。。居然有人说数据水。。。尼玛WA了6次。。。#include#include#include#include#include#include#include#include#includeusing namespace std;int n,ans,N,a[20][20],cnt[20];char map[5][5];bool vis[5][5];void ch
2012-08-26 16:15:03 223
原创 POJ 1015 Jury Compromise
这个,应该算dp吧。。。#include#include#include#include#include#include#include#include#includeusing namespace std;const int inf=10000000;int ans[30][30][1000];int main(){ int n,
2012-08-26 14:29:39 260
原创 POJ 1016 Numbers That Count
#include#include#include#include#include#include#include#include#includeusing namespace std;int main(){ char s2[100],s[20][100]; int i,j,cnt[100],x,y,loop; bool flag1; while(scanf("%
2012-08-25 14:01:25 241
原创 HDU 1030 Delta-wave
我会告诉你我把这道题当模拟题写的么。。。坑爹啊#include#include#include#include#include#include#include#include#includeusing namespace std;int a[100000];int main(){ int n,m,i,ans; double t=sqrt(10000000
2012-08-24 15:10:54 274
原创 HDU 2084 数塔 Python实现
初学Python,感觉写得不整洁。。得多练- -!输入数据方式不太一样,但思想是一致的import sysl=[]ans=[]for line in sys.stdin : l.append(list(map(int,line.split())))ans=l[0]for li in l[1:] : j=0 tmp=[] while j<len(
2012-08-24 01:33:45 381
原创 HDU 1027 Ignatius and the Princess II
全排列484ms,弱爆了。。#include#include#include#include#include#include#include#include#include#includeusing namespace std;int n,m,cnt,ans[1010];bool vis[1010],flag;void solve(int
2012-08-23 15:09:34 211
原创 HDU 1025 Constructing Roads In JGShining's Kingdom
最长上升子序列/*以下内容摘自http://blog.csdn.net/ice_crazy/article/details/7536332假设存在一个序列d[1..9] = 2 1 5 3 6 4 8 9 7,可以看出来它的LIS长度为5。下面一步一步试着找出它。我们定义一个序列B,然后令 i = 1 to 9 逐个考察这个序列。此外,我们用一个变量Len来记录现在最长算到
2012-08-23 13:51:06 539
原创 HDU 1026 Ignatius and the Princess I
bfs#include#include#include#include#include#include#include#include#include#includeusing namespace std;const int inf=100000000;char s[110][110];int n,m,dx[]={-1,1,0,0},dy[]={0,0,-1,1};
2012-08-22 16:02:27 203
原创 HDU 1075 What Are You Talking About
这题的代码写得好恶心。。二分查找,连改进的心情都没。。。#include#include#include#include#include#include#include#include#include#includeusing namespace std;char eng[501000][12],mars[501000][12],tran[3010]
2012-08-22 14:40:12 266
转载 简明 Vim 练级攻略 By 陈皓
vim的学习曲线相当的大(参看各种文本编辑器的学习曲线),所以,如果你一开始看到的是一大堆VIM的命令分类,你一定会对这个编辑器失去兴趣的。下面的文章翻译自《Learn Vim Progressively》,我觉得这是给新手最好的VIM的升级教程了,没有列举所有的命令,只是列举了那些最有用的命令。非常不错。——————————正文开始——————————你想以最快的速度学习人类
2012-08-14 21:20:09 7515
原创 HDU 3577 Fast Arrangement
成段更新的线段树- -!#include#include#include#include#include#include#includeusing namespace std;#define maxn 1000010#define l(i) ((i)<<1)#define r(i) ((i)<<1|1)struct node{ int left,
2012-08-14 20:07:13 410
原创 poj 2666 Back to Mother Ship
积分题,利用线速度算出角速度,对角速度进行积分,注意求积分是要满足初始条件:角度a=0#include#include#include#include#include#includeusing namespace std;const double pi=acos(-1.0);int main(){ int a,u,d; while(cin>>u>>a
2012-08-13 13:22:35 572
原创 POJ 1228 Grandpa's Estate
第一次做凸包,2Y,^ ^#include#include#include#include#includeusing namespace std;int n,pos;struct point{ int x,y;}p[1010];const int inf=0x7fffffff;int mult(point a,point b,point c){ if
2012-08-12 00:38:56 602
转载 欧拉函数
相关题目: http://acm.hdu.edu.cn/showproblem.php?pid=2824 pku 2478(与前n个数互质的个数的求和) http://acm.hdu.edu.cn/showproblem.php?pid=3508 素因子的积 http://acm.hdu.edu.cn/showproblem.php?pid=2710 题目很简单,就是输出N个数素数因子最大的
2012-08-11 00:58:52 1338
转载 POJ 2478 Farey Sequence
欧拉函数- -!#include#include#include#include#include#define N 1000010#define maxn 1000000using namespace std;long long phi[N],ans[N];int main(){ int i,j,n; for(i=1;i<=maxn;
2012-08-11 00:41:52 324
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人