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

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 阅读(319) 评论(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 阅读(273) 评论(0) 推荐(0)
 
 

公告


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