上一页 1 2 3 4 5 6 7 8 9 10 ··· 59 下一页
摘要: 题目链接: https://leetcode-cn.com/problems/k-th-smallest-in-lexicographical-order/ 题目大意: 给定整数 n 和 k,找到 1 到 n 中字典序第 k 小的数字。 注意:1 ≤ k ≤ n ≤ 109。 具体思路: 首先遍历的 阅读全文
posted @ 2019-07-17 15:36 Let_Life_Stop 阅读(989) 评论(0) 推荐(0) 编辑
摘要: 题目连接: https://leetcode-cn.com/problems/lexicographical-numbers/ 题目大意: 给定一个整数 n, 返回从 1 到 n 的字典顺序。 例如, 给定 n =1 3,返回 [1,10,11,12,13,2,3,4,5,6,7,8,9] 。 请尽 阅读全文
posted @ 2019-07-16 21:43 Let_Life_Stop 阅读(844) 评论(0) 推荐(0) 编辑
摘要: 题目连接: https://leetcode-cn.com/problems/queue-reconstruction-by-height/submissions/ 题目大意: 假设有打乱顺序的一群人站成一个队列。 每个人由一个整数对(h, k)表示,其中h是这个人的身高,k是排在这个人前面且身高大 阅读全文
posted @ 2019-07-14 16:01 Let_Life_Stop 阅读(570) 评论(0) 推荐(0) 编辑
摘要: 题目连接: https://leetcode-cn.com/problems/minimum-number-of-k-consecutive-bit-flips/ 题目大意: 在仅包含 0 和 1 的数组 A 中,一次 K 位翻转包括选择一个长度为 K 的(连续)子数组,同时将子数组中的每个 0 更 阅读全文
posted @ 2019-07-14 13:06 Let_Life_Stop 阅读(570) 评论(0) 推荐(0) 编辑
摘要: 题目连接: https://leetcode-cn.com/problems/find-pivot-index/ 题目大意: 找一个点,左边和右边相等。 具体思路: 前缀和+后缀和,线性遍历一遍即可。一定注意存在空数组的情况。 AC代码: 阅读全文
posted @ 2019-07-13 20:20 Let_Life_Stop 阅读(121) 评论(0) 推荐(0) 编辑
摘要: 题目连接:https://leetcode-cn.com/problems/two-sum/ 题目大意: 找出两个数,相加等于给定的值。 AC代码: 方法二: 阅读全文
posted @ 2019-07-13 19:28 Let_Life_Stop 阅读(126) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 using namespace std; 3 const int maxn = 2e5+100; 4 class Base 5 { 6 public: 7 Base(); 8 Base(int a); 9 Base(const Base& other); 10 Base& operator = ( const Base ... 阅读全文
posted @ 2019-06-29 22:01 Let_Life_Stop 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 题目链接: https://ac.nowcoder.com/acm/problem/15832 题目大意: 自己翻译,注意每次碰撞是两个中的一个消失,并不是两个都消失 具体思路: dp[i]表示i这个状态最大的能量是多少,三重for循环枚举 AC代码: acm生涯应该就到此结束了 阅读全文
posted @ 2019-06-27 17:00 Let_Life_Stop 阅读(217) 评论(0) 推荐(0) 编辑
摘要: 题目链接: https://ac.nowcoder.com/acm/problem/16122 题目大意: 中文 具体思路: 首先对全图跑一遍floyed,然后dp[i][j]表示第i个状态在j点停下来的最短距离。 AC代码: 记录路径 阅读全文
posted @ 2019-06-24 20:42 Let_Life_Stop 阅读(388) 评论(0) 推荐(0) 编辑
摘要: 题目链接: https://cn.vjudge.net/problem/Kattis-busplanning 题目大意: 自己翻译 具体思路: 问的别的,不是我的思路,, 二进制枚举这n个人的子集,判断哪几个状态是能够在一辆车上的,然后对于所有状态判断他的哪两个互补的子集能使得这个状态的人最少。 记 阅读全文
posted @ 2019-06-24 17:05 Let_Life_Stop 阅读(357) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 10 ··· 59 下一页