上一页 1 ··· 79 80 81 82 83 84 85 86 87 ··· 125 下一页

2019年12月16日

摘要: 地址 https://www.acwing.com/problem/content/description/851/ 给定一个n个点m条边的有向图,图中可能存在重边和自环,所有边权均为正值。 请你求出1号点到n号点的最短距离,如果无法从1号点走到n号点,则输出-1。 输入格式 第一行包含整数n和m。 阅读全文
posted @ 2019-12-16 16:59 itdef 阅读(407) 评论(0) 推荐(0)

2019年12月15日

摘要: 地址 https://leetcode-cn.com/contest/biweekly-contest-15/problems/minimum-falling-path-sum-ii/ 题目描述给你一个整数方阵 arr ,定义「非零偏移下降路径」为:从 arr 数组中的每一行选择一个数字,且按顺序选 阅读全文
posted @ 2019-12-15 00:24 itdef 阅读(290) 评论(0) 推荐(0)
摘要: 地址 https://leetcode-cn.com/contest/biweekly-contest-15/problems/remove-covered-intervals/ 目描述给你一个区间列表,请你删除列表中被其他区间所覆盖的区间。 只有当 c <= a 且 b <= d 时,我们才认为区 阅读全文
posted @ 2019-12-15 00:23 itdef 阅读(391) 评论(0) 推荐(0)
摘要: 地址 https://leetcode-cn.com/contest/biweekly-contest-15/problems/element-appearing-more-than-25-in-sorted-array/ 目描述给你一个非递减的 有序 整数数组,已知这个数组中恰好有一个整数,它的出 阅读全文
posted @ 2019-12-15 00:21 itdef 阅读(272) 评论(0) 推荐(1)
摘要: 地址 https://leetcode-cn.com/contest/biweekly-contest-15/problems/iterator-for-combination/ 题目描述请你设计一个迭代器类,包括以下内容: 一个构造函数,输入参数包括:一个 有序且字符唯一 的字符串 charact 阅读全文
posted @ 2019-12-15 00:19 itdef 阅读(393) 评论(0) 推荐(0)

2019年12月12日

摘要: 地址 http://poj.org/problem?id=3468 线段树模板 要背下此模板 1 #include <iostream> 2 #include <vector> 3 #include <math.h> 4 #include <algorithm> 5 6 7 using namesp 阅读全文
posted @ 2019-12-12 17:10 itdef 阅读(346) 评论(0) 推荐(0)
摘要: 地址 http://poj.org/problem?id=2456 解法 使用二分逐个尝试间隔距离 能否满足要求 检验是否满足要求的函数 使用的思想是贪心 第一个点放一头牛 后面大于等于尝试的距离才放置一头牛 如果能放置完所有的牛 那么就继续增加尝试的距离 否则就减少尝试的距离 代码 1 #incl 阅读全文
posted @ 2019-12-12 14:23 itdef 阅读(306) 评论(0) 推荐(0)
摘要: 地址 http://poj.org/problem?id=1064 题解 二分即可 其实 对于输入与精度计算不是很在行 老是被卡精度 后来学习了一个函数 floor 向负无穷取整 才能ac 代码如下 1 #include <iostream> 2 #include <vector> 3 #inclu 阅读全文
posted @ 2019-12-12 11:44 itdef 阅读(223) 评论(0) 推荐(0)

2019年12月10日

摘要: 地址 https://www.acwing.com/problem/content/862/ 给定一个n个点m条边的无向图,图中可能存在重边和自环。 请你判断这个图是否是二分图。 输入格式 第一行包含两个整数n和m。 接下来m行,每行包含两个整数u和v,表示点u和点v之间存在一条边。 输出格式 如果 阅读全文
posted @ 2019-12-10 17:04 itdef 阅读(334) 评论(0) 推荐(0)
摘要: 地址 http://poj.org/problem?id=1182 题解 可以考虑使用并查集解决 但是并不是简单的记录是否同一组的这般使用 每个动物都有三个并查集 自己 天敌 捕食 并查集 那么在获得一条信息后 我们先判断真伪 x不能吃x 自己 x y不能超过数目类型 当xy是同一类的时候 x不会出 阅读全文
posted @ 2019-12-10 15:09 itdef 阅读(280) 评论(0) 推荐(0)
上一页 1 ··· 79 80 81 82 83 84 85 86 87 ··· 125 下一页

导航