上一页 1 2 3 4 5 6 7 8 ··· 12 下一页

2012年9月9日

2012 ACM/ICPC Asia Regional Tianjin Online A very hard mathematic problem

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4282思路:枚举Y、Z ,二分X;View Code #include<stdio.h>__int64 num;int pd(__int64 z,__int64 y,__int64 a){ __int64 i,b,x; __int64 max=y-1,min=1; while(min<max) { x=(min+max)/2; b=x; for(i=1;i<z;i++) b*=x; if((b+a+x*y*z)>... 阅读全文

posted @ 2012-09-09 18:19 aigoruan 阅读(177) 评论(0) 推荐(0)

2012 ACM/ICPC Asia Regional Tianjin Online Intelligent IME

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4287思路:暴力View Code #include<stdio.h>#include<string>#include<iostream>#include<map>using namespace std;map<string,int>Map;char hash[150];char temp[5005][10];void inite(){ hash['a']=hash['b']=hash['c']= 阅读全文

posted @ 2012-09-09 18:16 aigoruan 阅读(194) 评论(0) 推荐(0)

2012 ACM/ICPC Asia Regional Tianjin Online Faulty Odometer

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4278思路:YYView Code #include<stdio.h>int ac[10]={0,1,2,2,3,4,5,6,7,7};int main(){ int a,n; while(scanf("%d",&a)!=EOF) { if(a==0) break; n=a; int i=1,s=0; while(a) { s+=ac[a%10]*i; i*=8; ... 阅读全文

posted @ 2012-09-09 18:13 aigoruan 阅读(138) 评论(0) 推荐(0)

2012 ACM/ICPC Asia Regional Tianjin Online Travel

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4284思路:预处理15个点之间的最短距离后暴力。View Code #include<stdio.h>#include<stdlib.h>#include<string.h>#include<iostream>using namespace std;const int maxn = 105;const int inf = 1<<29;int dis[maxn][maxn];int h[maxn],d[maxn],c[maxn],vis[maxn];i 阅读全文

posted @ 2012-09-09 18:11 aigoruan 阅读(289) 评论(0) 推荐(0)

2012年9月8日

2012 ACM/ICPC Asia Regional Changchun Online USACO ORZ

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4277思路:暴力;View Code #include<stdio.h>#include<iostream>#include<set>using namespace std;#define MAXN 16#define STA 1<<17int up,a,bc,b,c;int num[MAXN],val[STA];set<int>Map[150005];void inite(){ int i,pos,temp; for(i=0;i<=up;i+ 阅读全文

posted @ 2012-09-08 20:13 aigoruan 阅读(182) 评论(0) 推荐(0)

2012 ACM/ICPC Asia Regional Changchun Online A Simple Problem with Integers

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4267思路:树状数组更新。View Code #include<stdio.h>#include<string.h>#include<iostream>#define lowbit(x) (x)&(-x)using namespace std;const int maxn = 50005;int sum[maxn][11][11],n;int as[maxn];void add(int x,int c,int k,int md){ for(; x <= n; 阅读全文

posted @ 2012-09-08 20:10 aigoruan 阅读(141) 评论(0) 推荐(0)

2012 ACM/ICPC Asia Regional Changchun Online LianLianKan

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4272呜呜,有谁用dp过的,请说一下思路。YYYYYYYYYYYMMMMMMMMM路过的大神。View Code #include<stdio.h>#include<string.h>int as[1005],vis[1005];int main(){ int i,j,k,n; while(scanf("%d",&n)==1){ memset(vis,0,sizeof(vis)); for(i = 1; i <= n; ++ i) scanf(&quo 阅读全文

posted @ 2012-09-08 18:49 aigoruan 阅读(201) 评论(0) 推荐(0)

2012 ACM/ICPC Asia Regional Changchun Online Alice and Bob

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4268思路:贪心+树状数组。把两个人的x,y按x优先排序,然后离散化。然后从alice的最小x开始枚举,把bob的所有的Xb<=Xa的Yb都放到一个堆里。然后在堆里找一个最大的Yb,使得Yb<=Ya,找到则删除。(可以转化树状数组找第k大哈)View Code #include<stdio.h>#include<string.h>#include<iostream>#include<algorithm>#define lowbit(x) (x)&am 阅读全文

posted @ 2012-09-08 18:15 aigoruan 阅读(285) 评论(0) 推荐(0)

2012年9月1日

uva 11990 - ``Dynamic'' Inversion

摘要: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=3141题意:给一个N的排列。有M个操作,每次把排列中的一个数删除,问把这个数删除前总的逆序数是多少。思路:线段树+树状数组(也就是是树套树)。建树时,要把各区间内的数排好序。线段树中每个节点维护一个树状数组,记录这个区间有多少个数已删除。查找时,二分这个数在这个区间上的位置,然后算出小于它的有多少个,大于他的有多少个,再用树状数组去除删除的。更新时,二分这个数在这个区间的位置,更新 阅读全文

posted @ 2012-09-01 10:53 aigoruan 阅读(780) 评论(0) 推荐(0)

2012年8月26日

ZOJ Monthly, August 2012 3643 Keep Deleting

摘要: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3643题意:给出A串和B串,删除B串中的A串。思路:栈+暴力,strcmp函数比较的时候,如果不相等就会马上退出,这样最坏的时间复杂度是O(maxn/256*(1+256)*256/2)。ps:不知道官方解题是怎么样弄的。View Code #include<stdio.h>#include<string.h>#define maxn 512005char as[maxn],bs[2000],st[maxn];int ans,tp;int main 阅读全文

posted @ 2012-08-26 21:41 aigoruan 阅读(196) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 7 8 ··· 12 下一页

导航