• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
 






tim11

 
 

Powered by 博客园
博客园 | 首页 | 新随笔 | 联系 | 订阅 订阅 | 管理

2012年11月6日

zoj3597(Hit the Target!)(线段树)
摘要: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3597他人具体代码:View Code #include<cstdio>#include<cstring>#include<algorithm>using namespace std;#define lson l,m,x<<1#define rson m+1,r,x<<1|1const int maxn = 100010;int Max[maxn<<2],col[maxn<<2];stru 阅读全文
posted @ 2012-11-06 18:38 tim11 阅读(279) 评论(0) 推荐(0)
 

2012年11月3日

hdu3564(Another LIS)(线段树)
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3564(1)插入元素;求最长上升子序列。他人具体代码:View Code #include<stdio.h>#include<string.h>#define lowbit(i) (i&(-i))const int MAXN=100005;const int MAXLOG=17;int B[MAXN],pos[MAXN];int N;void update(int i,int value){ //维护空位的个数 for(;i<=N;i+=lowbit(i)) B[i]+= 阅读全文
posted @ 2012-11-03 21:48 tim11 阅读(226) 评论(0) 推荐(0)
 

2012年11月2日

poj2378(Tree Cutting)(动态规划)
摘要: http://poj.org/problem?id=2378他人具体代码:View Code #include<cstdio>#include<vector>#include<cstring>using namespace std;const int maxn = 10010;vector<int> edge[maxn];int sum[maxn],ans[maxn],n;void dfs(int u,int fa){ sum[u]=1; int i,j; bool flag=true; for(i=0;i<edge[u].size();i 阅读全文
posted @ 2012-11-02 23:42 tim11 阅读(185) 评论(0) 推荐(0)
 

2012年11月1日

poj2482(Stars in Your Window)(线段树)
摘要: http://poj.org/problem?id=2482(1)普通的线段树问题。他人具体代码:View Code #include<cstdio>#include<iostream>#include<cstring>#include<algorithm>#define ls rt<<1#define rs rt<<1|1#define lson l,m,ls#define rson m+1,r,rsusing namespace std;const int mm=11111;const int mn=mm<< 阅读全文
posted @ 2012-11-01 17:36 tim11 阅读(205) 评论(0) 推荐(0)
 

2012年10月30日

poj2155(Matrix)(树状数组)
摘要: http://poj.org/problem?id=2155题意:一个矩阵元素均为0,1, 快速更新指定的子矩阵,快速询问的是一个点。他人具体代码:View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>using namespace std;#define maxn 1005int c[maxn][maxn];int Row, Col;inline int Lowbit(const int &x){ return x & 阅读全文
posted @ 2012-10-30 21:10 tim11 阅读(159) 评论(0) 推荐(0)
 

2012年10月29日

poj1961(Period)(字符串)
摘要: http://poj.org/problem?id=1961(1)题意:给定一个长度为n的字符串,求他的前缀且前缀满足本身为周期字符串。例:aabaabaab 长度为9 周期为3(2)用到kmp他人具体代码:View Code #include <cstdio>#include <iostream>#include <cstring>#define maxn 1000004using namespace std;int next[maxn];void GetNext(char *s){ int len = strlen(s); int i,j; i = 0; 阅读全文
posted @ 2012-10-29 22:01 tim11 阅读(145) 评论(0) 推荐(0)
 

2012年10月28日

hdu4283(You Are the One)(dps+dp)
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4283(1)代码量短,主要是要分析清楚问题的本质。用到深搜和动态规划,精髓是动态规划里包含的思维。他人代码:View Code #include <iostream>#include <cstdio>#include <algorithm>#define INF 0x3f3f3f3f#define MAXN 100using namespace std;int N, s[MAXN+5], f[MAXN+5][MAXN+5], seq[MAXN+5];int dfs(int 阅读全文
posted @ 2012-10-28 17:25 tim11 阅读(181) 评论(0) 推荐(0)
 

2012年10月27日

hdu4410(Boomerang)(计算几何)
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4410(1)由于多边形的边平行于坐标轴,所以n只能是4,6,8。n为4和6的时候只有一种形状。n为8的时候有四种形状: 1)凹形; 2)T行; 3)楼梯行; 4)矩形去掉对角。他人具体代码:View Code #include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> #define int64 __int64 #defi 阅读全文
posted @ 2012-10-27 22:21 tim11 阅读(236) 评论(0) 推荐(0)
 
hdu4328(Cut the cake)(dp)
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4328(1)题目有改动,两色相间的必须是正方形。他人具体代码:View Code #include <cstdio>#include <cstring>const int MAXN = 1005;int left[3][MAXN][MAXN], right[3][MAXN][MAXN], top[3][MAXN][MAXN];char a[MAXN][MAXN];inline int min(const int &x, const int &y){ return x & 阅读全文
posted @ 2012-10-27 00:16 tim11 阅读(189) 评论(0) 推荐(0)
 

2012年10月25日

hdu4335(What is N?)(数论)
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4335这是道数论的题目,会的人可以瞬秒。(1)先要熟悉欧拉定理:gcd(n, p) = 1时,n^(phi(p)) ≡ 1 (mod p);(2)各种条件下的n:1) n! < phi(p) ; 2)phi(p) <= n! < s!, s=min{x|x! mod phi(p)=0}; 3)n! % phi(p) = 0; 4)其他;(3)其实没多少看得懂。他人具体代码:View Code #include <cstdlib>#include <cstdio>#in 阅读全文
posted @ 2012-10-25 22:34 tim11 阅读(183) 评论(0) 推荐(0)
 
下一页