• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
KasenBob
博客园 | 首页 | 新随笔 | 新文章 | 联系 | 订阅 订阅 | 管理
上一页 1 2 3 4 5 6 7 8 9 下一页

2019年5月19日

Division
摘要: 题目链接:Division 思路: 枚举被除数和除数,其实每次只要枚举除数或者被除数其中一个,在知道两个值后就可以知道第三个值,然后再判断能否采用 代码: 阅读全文
posted @ 2019-05-19 10:49 KasenBob 阅读(338) 评论(0) 推荐(0)
 
 

2019年5月7日

CodeForces 551C GukiZ hates Boxes
摘要: 题目链接:CodeForces 551C GukiZ hates Boxes 解题思路: 题目要求最短时间,因此我们可以先考虑最长时间,最长时间一定是一个学生从开始走到结束,每走到一处就把该处箱子搬空,所以最长时间等于走到最后一个有箱子格子的步数ed加箱子总数sum。 接下来二分所需时间,直接搜索最 阅读全文
posted @ 2019-05-07 20:59 KasenBob 阅读(250) 评论(0) 推荐(0)
 
CodeForces 409C Magnum Opus
摘要: 题目链接:CodeForces 409C Magnum Opus 解题思路: 读懂题目是关键。。。简单来讲就是每次炼金都需要1个Aqua Fortis,1个Aqua Regia,2个Amalgama,7个Minium,4个Vitriol 代码: 阅读全文
posted @ 2019-05-07 20:52 KasenBob 阅读(228) 评论(0) 推荐(0)
 
 

2019年5月6日

CodeForces 91A Newspaper Headline
摘要: 题目描述:CodeForces 91A Newspaper Headline 思路: 先用一个b数组记录A字符串中出现的字母,用a数组记录字母出现的顺序,然后遍历B字符串搜索 代码: 阅读全文
posted @ 2019-05-06 21:40 KasenBob 阅读(383) 评论(0) 推荐(0)
 
 

2019年3月29日

广搜+深搜(搜索最短路径+最短步数)
摘要: #include #include #include #include #include using namespace std; const int maxn=10; struct P { int x,y; }point[maxn]; struct PP { int fx,fy; }path[maxn][maxn]; int num[maxn][maxn... 阅读全文
posted @ 2019-03-29 22:03 KasenBob 阅读(516) 评论(0) 推荐(0)
 
 

2019年3月3日

分特产 (排列组合)
摘要: 选取m件物品分给n个人即C(m+n-1)(n-1) C(n)(m)=C(n-1)(m-1)+C(n-1)(m) 代码如下: 阅读全文
posted @ 2019-03-03 14:23 KasenBob 阅读(251) 评论(0) 推荐(0)
 
 

2019年3月1日

输出欧拉路径(并查集+佛罗来算法)
摘要: #include using namespace std; const int maxn=100; stacks;/*输出欧拉回路*/ vectorway[maxn];/*记录与每个点相连接的点*/ int edge[maxn][maxn];/*记录两点是否联通*/ int in[maxn];/*记录每个度的入度*/ int fa[maxn];/*用做并查集查询图是否联通*/ int n,m; ... 阅读全文
posted @ 2019-03-01 20:13 KasenBob 阅读(365) 评论(0) 推荐(0)
 
 

2019年2月28日

LIS(最大上升子序列)
摘要: 代码实现如下: 可进行优化,优化后代码为: 阅读全文
posted @ 2019-02-28 13:41 KasenBob 阅读(273) 评论(0) 推荐(0)
 
 

2019年2月27日

背包问题
摘要: 一、01背包 问题描述: 有N件物品和一个容量为V的背包。第i件物品的费用是c[i],价值是w[i]。求解将哪些物品装入背包可使价值总和最大。 解答: 状态转移方程:f[i][v]=max{f[i-1][v],f[i-1][v-c[i]]+w[i]} 即将问题分解为“将前i件物品放入容量为v的背包中 阅读全文
posted @ 2019-02-27 19:29 KasenBob 阅读(131) 评论(0) 推荐(0)
 
 

2019年2月25日

归并排序求逆序对
摘要: #include void Merge(int ,int ,int ); void mergeSort(int ,int ); int ch[20000],temp[20000]; int count = 0; void mergeSort(int lo,int hi) { if(lo ch[j]) { count+= mid - i ... 阅读全文
posted @ 2019-02-25 23:04 KasenBob 阅读(134) 评论(0) 推荐(0)
 
 
上一页 1 2 3 4 5 6 7 8 9 下一页

公告


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