• 博客园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月6日

POJ 2573
摘要: 还有一道比这道题更简单但是一样的题,忘了题号了,那题只求最少时间,实际上两题差不多,贪心策略1、让划船划的最快的人依次与最慢的两人组队去对面,然后他在把船划回来,这样到对岸的时间花费很多,但是回来的时间少。2、先让最快的两人去对岸,然后让其中一人把船划回来,再让最慢的两人组队去对岸,让先前还剩下那人把船划回来,这样使得到对岸的时间减少了,但是划回来的时间增多了。依靠上面两个贪心策略,执行一次后得到的状态都是相等的,于是可以递归解决,每次进行比较,看哪种贪心策略更优,直到要过河的人小于4#include<cstdio>#include<cstring>#include&l 阅读全文
posted @ 2012-09-06 21:06 tmeteorj 阅读(375) 评论(0) 推荐(0)
 
POJ 2565
摘要: 模拟,照着说的做就行了。#include<cstdio>#include<cstring>#include<algorithm>using namespace std;const double eps=1e-8;struct data{ int h,m,s; double tot,speed; data(int _h,int _m,int _s) { h=_h;m=_m;s=_s; tot=_h*60+_m+_s/60.0; speed=0; } data(){} void print() { ... 阅读全文
posted @ 2012-09-06 20:32 tmeteorj 阅读(194) 评论(0) 推荐(0)
 
POJ 1690
摘要: 好坑爹的一道字符串类型的模拟题,看来我就不适合做这种题,无论怎样简单,总会错几次才能对。#include<cstdio>#include<cstring>using namespace std;int main(){ int T; for(scanf("%d ",&T); T; T--) { char s[1000]; char ans[1000]; int st[1000]; gets(s); int len,i,j,num=0; for(i=j=0; s[i]; i++) {... 阅读全文
posted @ 2012-09-06 19:45 tmeteorj 阅读(232) 评论(0) 推荐(0)
 
 

公告


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