雕刻时光

just do it……nothing impossible
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
上一页 1 ··· 21 22 23 24 25 26 27 28 29 ··· 50 下一页

2013年1月12日

摘要: http://ac.jobdu.com/problem.php?cid=1039&pid=19在数组中的两个数字,如果前面一个数字大于后面的数字,则这两个数字组成一个逆序对。输入一个数组,求出这个数组中的逆序对的总数。先离散化在统计后面比前面大的有几个保存到all逆序对队 n*(n-1)/2-all 注意long longView Code #include<cstdio>#include<iostream>#include<algorithm>using namespace std;long long N;long long tree[200009 阅读全文

posted @ 2013-01-12 13:31 huhuuu 阅读(819) 评论(0) 推荐(0) 编辑

2012年5月4日

摘要: 注意不是优先队列,因为优先队列只能对队头进行操作,所以……单调队列,从队头到队尾所有都可以操作http://acm.hdu.edu.cn/showproblem.php?pid=4122一开始把时间,什么年月日,转化为时间小时(开始搞错WA了一次)后来使用单调队列,维护队列,使之到i 生产的最优,过期的出队列View Code #include<stdio.h>#include<string.h>#include<iostream>#include<algorithm>using namespace std;char Month[13][9]={ 阅读全文

posted @ 2012-05-04 15:32 huhuuu 阅读(793) 评论(0) 推荐(0) 编辑

2012年4月21日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4217View Code #include<stdio.h>struct data{ int l,r; int sum;}node[1962144];void build(int ll,int rr,int n){ node[n].l=ll; node[n].r=rr; node[n].sum=rr-ll+1; if(ll==rr)return ; int mid=(ll+rr)>>1; build(ll,mid,n+n); build(mid+1,rr,... 阅读全文

posted @ 2012-04-21 21:13 huhuuu 阅读(152) 评论(0) 推荐(0) 编辑

2012年4月10日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3549View Code #include<stdio.h>#include<iostream>#include<algorithm>using namespace std;typedef struct {int v,next,val;} edge;const int MAXN=20010;const int MAXM=500010; edge e[MAXM];int p[MAXN],eid; inline void init(){memset(p,-1,sizeof(p) 阅读全文

posted @ 2012-04-10 18:27 huhuuu 阅读(580) 评论(0) 推荐(0) 编辑

2012年4月9日

摘要: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3497//最后判断从(1,1)开始如果走p步,只能到终点,则True//如果p步还可以到其他点,则Maybe//如果p步不能到终点,则False注意n==m==1的情况矩阵乘法每次乘都要将矩阵最后一行赋值0,因为到达终点了就不能在出来了View Code #include<stdio.h>#include<string.h>struct data{ int map[30][30];};data res;int n,as[30],ha1[1000]; 阅读全文

posted @ 2012-04-09 20:11 huhuuu 阅读(386) 评论(0) 推荐(0) 编辑

2012年4月8日

摘要: http://www.bnuoj.com/bnuoj/problem_show.php?pid=10787下电影的时间所用最少是多少做法:贪心每部电影全速下载所需要的时间的最大值和所有电影同时满速下载的时间,两者取大View Code #include<stdio.h>long long gcd(long long a,long long b){ if (b==0) return a; else return gcd(b,a%b);}int main(){ long long n,m; while(scanf("%lld%lld",&n,&m)! 阅读全文

posted @ 2012-04-08 22:24 huhuuu 阅读(227) 评论(0) 推荐(0) 编辑

2012年4月6日

摘要: http://poj.org/problem?id=2230vectorView Code #include<iostream>#include<vector>using namespace std;vector<int>map[10009];void init(int n){ int i; for(i=1;i<=n;i++) map[i].clear();}void find(int now){ int i; for(i=1;i<=map[now].size();i++) { while(map[now][i-1]!=0){ ... 阅读全文

posted @ 2012-04-06 21:56 huhuuu 阅读(323) 评论(0) 推荐(0) 编辑

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4192这道题A的好辛苦啊!!!易错点:开始时 a,b当做个位数在考虑2 42 93 11(a-b)就会错,哎思维不严密啊!!!View Code #include<iostream>#include<algorithm>#include<cstring>#include<string>#include<cmath>#include<cstdio>#include<cstdlib>#include<map>using 阅读全文

posted @ 2012-04-06 20:23 huhuuu 阅读(497) 评论(0) 推荐(0) 编辑

2012年4月5日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3739建图用LIS处理数字10 10 20 1 2 2 ->>dp :1 1 2 1 1 2 MAX=2每个点拆做两个点建图 s 连所有dp为1的点前驱(i)汇点t连所有dp为max的点后驱(i+n)点与点的关系如果点 i与点j(i<j) dp[i]+1== [j]&&s[i]<s[j]则点i前驱与点j后驱建立容量为1的容量网络最小割OKView Code #include<iostream>#include<cmath>#include< 阅读全文

posted @ 2012-04-05 20:18 huhuuu 阅读(279) 评论(0) 推荐(0) 编辑

2012年4月4日

摘要: View Code [cpp] view plaincopy//适用于正整数 template <class T> inline void scan_d(T &ret) { char c; ret=0; while((c=getchar())<'0'||c>'9'); while(c>='0'&&c<='9') ret=ret*10+(c-'0'),c=getchar(); } ②[cpp] view plaincopy//适用于正负整数 template 阅读全文

posted @ 2012-04-04 19:38 huhuuu 阅读(325) 评论(0) 推荐(0) 编辑

上一页 1 ··· 21 22 23 24 25 26 27 28 29 ··· 50 下一页