上一页 1 ··· 48 49 50 51 52 53 54 55 56 ··· 71 下一页
摘要: 直接枚举a1和d。View Code 1 /* 2 ID: your_id_here 3 PROG: ariprog 4 LANG: C++ 5 */ 6 #include <iostream> 7 #include<cstdio> 8 #include<cstring> 9 using namespace std;10 int f[200000];11 int main()12 {13 freopen("ariprog.in","r",stdin);14 freopen("ariprog.out" 阅读全文
posted @ 2012-11-12 20:40 _雨 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 之前做的一道题,忘记发了,纠结了好久,把题意想复杂了,就是直接枚举*号位置上的数。View Code 1 /* 2 ID: your_id_here 3 PROG: crypt1 4 LANG: C++ 5 */ 6 #include <iostream> 7 #include<cstdio> 8 #include<string.h> 9 using namespace std;10 int count,f[100];11 int judge(int s)12 {13 int i,flag = 1,m = s;14 while(s)15 {16 ... 阅读全文
posted @ 2012-11-12 19:42 _雨 阅读(162) 评论(0) 推荐(0) 编辑
摘要: 做了几天,bfs一直超内存,dfs一直死循环,最后直接枚举过了,每个操作最多用3次,9重循环枚举每个操作的次数。View Code 1 /* 2 ID: your_id_here 3 PROG: clocks 4 LANG: C++ 5 */ 6 #include <iostream> 7 #include<cstdio> 8 #include<cstring> 9 using namespace std; 10 int pjudge(int *x,int *a) 11 { 12 int i,j,k; 13 int flag = 1; 14 ... 阅读全文
posted @ 2012-11-12 19:38 _雨 阅读(202) 评论(2) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1541题被划在线段树里 刚开始想着是求区间k值 写着写着觉得错了 看着像求逆序数 写了个树状数组 怎么都过不了 无奈。。View Code 1 #include <iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<algorithm> 5 using namespace std; 6 #define N 50000 7 struct node 8 { 9 int x,y,p;10 }s[N&l 阅读全文
posted @ 2012-10-22 18:49 _雨 阅读(182) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2795放在第几行 就是第几行的剩余空值x》xi 以行建树 求区间第K值View Code 1 #include <iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<algorithm> 5 using namespace std; 6 #define N 200010 7 #define LL __int64 8 LL s[N<<2],h,ww; 9 void build(int 阅读全文
posted @ 2012-10-21 22:03 _雨 阅读(182) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=3225先贴代码 有空再解释View Code 1 #include <iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<algorithm> 5 using namespace std; 6 #define N 140000 7 int s[N<<2],kc[N<<2],hash[N]; 8 void build(int l,int r,int w) 9 { 10 kc[w] = 0; 11 s[w] 阅读全文
posted @ 2012-10-21 22:00 _雨 阅读(194) 评论(0) 推荐(0) 编辑
摘要: A 判断不同字母的个数为偶数还是奇数#include <iostream>#include<cstdio>#include<cstring>#include<algorithm>using namespace std;int main(){ int i,j,k,n,num[500]; memset(num,0,sizeof(num)); char str[201]; gets(str); k = strlen(str); for(i = 0 ; i < k ; i++) num[str[i]]++; int count = 0; for(i 阅读全文
posted @ 2012-10-21 21:58 _雨 阅读(309) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=3667之前网络赛水过一道区间合并的题 当时是全靠运气试对的 。昨天纠结了一晚上也没看出来哪错,改的都跟人家代码一样了还是不对,今天又重新敲了一遍,莫名的就对了,,开两个数组分别存这个区间两端点的连续区间 再开一标记数组 用来更新 向上向下都要更新View Code 1 #include <iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<algorithm> 5 using namespace std; 6 #define 阅读全文
posted @ 2012-10-18 13:35 _雨 阅读(214) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1330这题只有一个询问,将一个节点的向上的标记下,再从另一个节点走一遍,遇到第一个被标记的就是 整个算法的最坏时间复杂度是O(Q*n),Q是询问的次数。View Code 1 #include <iostream> 2 #include<cstdio> 3 #include<cstring> 4 using namespace std; 5 int father[10010],f[10010]; 6 int main() 7 { 8 int g,i,j,k,n,a,b,t,c,d; 9 cin>&g 阅读全文
posted @ 2012-10-11 17:41 _雨 阅读(167) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4135交了十几次,。最后发现理解错题意了,区间包含右端点,一直按不包含做的。。求出N的质因数 根据容斥原理解出区间数能被质因数整除的 再减掉View Code 1 #include <iostream> 2 #include<cstdio> 3 #include<cmath> 4 #include<cstring> 5 using namespace std; 6 #define LL __int64 7 LL sum1,sum2,a,b,n; 8 int g, 阅读全文
posted @ 2012-10-11 08:36 _雨 阅读(194) 评论(0) 推荐(0) 编辑
上一页 1 ··· 48 49 50 51 52 53 54 55 56 ··· 71 下一页