• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
tmeteorj
Nothing is so big that it is impossible to get over, and hurt only serves to make us stronger. 没有什么事是大到无法战胜的,痛苦也只会让我们变得更加坚强。
博客园 | 首页 | 新随笔 | 新文章 | 联系 | 订阅 订阅 | 管理
上一页 1 ··· 15 16 17 18 19 20 21 下一页

2012年9月5日

POJ 1270
摘要: dfs输出原图所有拓扑序就行了。#include<cstdio>#include<cstring>#include<cctype>using namespace std;int d[30],head[30],nc,n;struct edge{ int to,next;}edge[200];void add(int a,int b){ edge[nc].to=b;edge[nc].next=head[a];head[a]=nc++;}char ans[30];void dfs(int k){ if(k==n) { puts(ans); retu... 阅读全文
posted @ 2012-09-05 20:49 tmeteorj 阅读(371) 评论(0) 推荐(0)
 
POJ 1695
摘要: 直接DP,做完看别人说是用类似于双调欧几里得旅行商问题一样的方法解,仔细一看我的代码,貌似也和那旅行商问题做法差不多~~这题坑爹之处在于,不能用floyd去优化,也就是说说好了从a到c是99,然后你不能靠先到b再到c来优化。。View Code 1 #include<cstdio> 2 #include<cstring> 3 #include<queue> 4 using namespace std; 5 int cos[50][50],dp[2][33][33][33]; 6 struct data 7 { 8 int x,y,z; 9 data() {} 阅读全文
posted @ 2012-09-05 20:22 tmeteorj 阅读(267) 评论(0) 推荐(1)
 
POJ 2584
摘要: 裸的最大流View Code 1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4 using namespace std; 5 const int N=2000,M=10000; 6 const int inff=1<<29; 7 int head[N],nc; 8 struct edge 9 { 10 int x,y,next; 11 int cap; 12 } edge[M*3]; 13 void add(int x,int y,int cap) 14 { 15 edg 阅读全文
posted @ 2012-09-05 19:10 tmeteorj 阅读(168) 评论(0) 推荐(0)
 
 

2012年9月4日

POJ 2225
摘要: 三维最短路View Code 1 #include<cstdio> 2 #include<cstring> 3 #include<queue> 4 #include<algorithm> 5 using namespace std; 6 struct data 7 { 8 int x,y,z; 9 bool operator==(const data &ne)const10 {11 return x==ne.x&&y==ne.y&&z==ne.z;12 }13 data(){}14 data(int _x, 阅读全文
posted @ 2012-09-04 21:30 tmeteorj 阅读(220) 评论(0) 推荐(0)
 
POJ 3044
摘要: 姑且算作贪心吧,从左往右遍历,对于每一个从点,如果它的那个高度没有被其他木板占据,就让它尽可能向右延伸,最后看有多少次这种伸展操作。可以利用像并查集一样的结构来储存每个点最多能延伸到多远。View Code 1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4 using namespace std; 5 int to[50005],a[50005],y[500005]; 6 int main() 7 { 8 int n,w; 9 while(scanf("%d%d" 阅读全文
posted @ 2012-09-04 20:48 tmeteorj 阅读(486) 评论(0) 推荐(0)
 
POJ 2437
摘要: 贪心策略,从左往右,在保证最左边那点能覆盖同时尽可能往右覆盖,貌似很多题都可以这样贪。View Code 1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4 using namespace std; 5 struct data 6 { 7 int s,e; 8 bool operator<(const data &ne)const 9 {10 if(s!=ne.s)11 return s<ne.s;12 else13 ... 阅读全文
posted @ 2012-09-04 20:09 tmeteorj 阅读(320) 评论(0) 推荐(0)
 
POJ 3450
摘要: 二分长度,枚举字串,KMP判断。View Code 1 #include<cstdio> 2 #include<algorithm> 3 #include<cstring> 4 using namespace std; 5 char s[4005][205]; 6 char ans[205]; 7 int next[205],n; 8 void getnext(char sr[]) 9 {10 int i,j;11 i=0;j=-1;next[0]=-1;12 for(;sr[i]!='\0';)13 {14 if(j==-1||sr[i]= 阅读全文
posted @ 2012-09-04 19:25 tmeteorj 阅读(274) 评论(0) 推荐(0)
 
 

2012年9月3日

POJ 2110
摘要: O(n^3log(n))47MS水过,枚举高度差log(n),枚举最低高度n,dfs一遍n^2View Code 1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4 using namespace std; 5 bool mark[105][105]; 6 int map[105][105]; 7 int n; 8 bool dfs(int x,int y,int mmin,int len) 9 {10 mark[x][y]=true;11 if(x==n&&y==n) 阅读全文
posted @ 2012-09-03 20:15 tmeteorj 阅读(200) 评论(0) 推荐(0)
 
POJ 2960
摘要: 利用SG函数特性,和的SG函数等于单独SG函数的异或,然后对预处理SG函数View Code 1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4 using namespace std; 5 int sg[10005]; 6 bool mark[10005][105]; 7 int s[105]; 8 int main() 9 {10 int m;11 while(scanf("%d",&m)&&m)12 {13 memset(mark,fa 阅读全文
posted @ 2012-09-03 19:35 tmeteorj 阅读(245) 评论(0) 推荐(0)
 
 

2012年9月2日

POJ 3436
摘要: 虽然一次秒过六级,但还是觉得这种冗长的题目非常蛋疼~3进制位压缩以进行判断是否有边,接着就是一次最大流,判断最后经过了哪些边只用考虑拆点后右边的点发出去的通往左边的点的那些边里初始流量减去现在流量是否等于0即可。View Code 1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4 using namespace std; 5 const int N=200,M=20000; 6 const int inff=10000000; 7 int head[N],nc; 8 struct e 阅读全文
posted @ 2012-09-02 12:13 tmeteorj 阅读(218) 评论(0) 推荐(0)
 
 
上一页 1 ··· 15 16 17 18 19 20 21 下一页

公告


博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3