雕刻时光

just do it……nothing impossible
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2011年3月18日

摘要: G++提交会超时,C++不会超时View Code #include<iostream>#include<stdio.h>#include<string.h>#include<algorithm>using namespace std;int main(){ int a[209],n,m,t,i; scanf("%d",&t); bool use; while(t--) { use=0; scanf("%d%d",&n,&m); for(i=0;i<n;i++) scanf(& 阅读全文

posted @ 2011-03-18 17:19 huhuuu 阅读(330) 评论(0) 推荐(0) 编辑

摘要: 用到STL里的next_permutation(&a[0],&a[le])//说明a[0]->a[le-1]是自由排列的View Code #include<iostream>#include<string.h>#include<algorithm>using namespace std;bool cmp(char a,char b){ return a<b;}int main(){ char a[209]; while(gets(a)) { int le=strlen(a); sort(&a[0],&a[le], 阅读全文

posted @ 2011-03-18 16:28 huhuuu 阅读(764) 评论(0) 推荐(0) 编辑

摘要: nlog(n)算法View Code #include<stdio.h>#define MAXN 30009int n,a[MAXN],s[MAXN],t[MAXN];//序列存在s里int lis()//单调不降子序列nlogn算法 { int l,r,mid,len=1; a[1]=s[1]; for(int i=2;i<=n;i++) { l=1,r=len; while(l<=r) { mid=(l+r)>>1;//除2 if(a[mid]<=s[i]) l=mid+1;//不降 else r=mid-1;//二分查找 } a[l]=s[i]; 阅读全文

posted @ 2011-03-18 11:22 huhuuu 阅读(437) 评论(0) 推荐(0) 编辑