• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
\0\0\0
博客园    首页    新随笔    联系   管理    订阅  订阅

随笔分类 -  数据结构/算法

蓝桥杯历届试题——蚂蚁感冒

摘要:问题描述 长100厘米的细长直杆子上有n只蚂蚁。它们的头有的朝左,有的朝右。 每只蚂蚁都只能沿着杆子向前爬,速度是1厘米/秒。 当两只蚂蚁碰面时,它们会同时掉头往相反的方向爬行。 这些蚂蚁中,有1只蚂蚁感冒了。并且在和其它蚂蚁碰面时,会把感冒传染给碰到的蚂蚁。 请你计算,当所有蚂蚁都爬离杆... 阅读全文
posted @ 2015-04-08 14:42 \0\0\0 阅读(289) 评论(0) 推荐(0)
列车重排

摘要:数据结构书上的。。#include #include using namespace std;/* run this program using the console pauser or add your own getch, system("pause") or input loop */// ... 阅读全文
posted @ 2015-03-26 19:09 \0\0\0 阅读(181) 评论(0) 推荐(0)
回溯问题总结

摘要:就简单背包问题(背包一)和四染色问题简单的回溯问题可以有以下这个模型 int trying = 0; do { while( 满足条件,可以进栈 ) { 进栈 设置尝试的新值:简单的分有两种 1、如简单背包的:物品互斥,则trying=trying + 1; ... 阅读全文
posted @ 2015-03-25 22:16 \0\0\0 阅读(276) 评论(0) 推荐(0)
地图四染色

摘要:数据结构书上的。。。依旧回溯#include #include using namespace std;/* run this program using the console pauser or add your own getch, system("pause") or input loop ... 阅读全文
posted @ 2015-03-25 22:10 \0\0\0 阅读(280) 评论(0) 推荐(0)
背包一

摘要:数据结构书上的背包问题,最基本的背包问题。简单回溯,数字模拟栈。#include using namespace std;/* run this program using the console pauser or add your own getch, system("pause") or in... 阅读全文
posted @ 2015-03-25 20:47 \0\0\0 阅读(166) 评论(0) 推荐(0)

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