上一页 1 ··· 55 56 57 58 59 60 61 62 63 ··· 68 下一页
摘要: 给你两个有序整数数组 nums1 和 nums2,请你将 nums2 合并到 nums1 中,使 nums1 成为一个有序数组。 说明: 初始化 nums1 和 nums2 的元素数量分别为 m 和 n 。你可以假设 nums1 有足够的空间(空间大小大于或等于 m + n)来保存 nums2 中的 阅读全文
posted @ 2020-05-09 12:04 XXXSANS 阅读(171) 评论(0) 推荐(0)
摘要: 给定一个排序数组,你需要在 原地 删除重复出现的元素,使得每个元素只出现一次,返回移除后数组的新长度。 不要使用额外的数组空间,你必须在 原地 修改输入数组 并在使用 O(1) 额外空间的条件下完成。 示例 1: 给定数组 nums = [1,1,2], 函数应该返回新的长度 2, 并且原数组 nu 阅读全文
posted @ 2020-05-09 11:03 XXXSANS 阅读(155) 评论(0) 推荐(0)
摘要: 1)求an当n很大时如10^9Java也不能处理,这时候要用到快速幂 0.分治法 int fastPow(int a, int n) { if (n == 1)return a; int tmp = fastPow(a, n / 2); if (n % 2 == 1)return tmp * tmp 阅读全文
posted @ 2020-04-30 11:16 XXXSANS 阅读(301) 评论(0) 推荐(0)
摘要: 求 n 个矩形中奇数个矩形覆盖区域的面积和。 n 个矩形中奇数个矩形覆盖区域的面积和。 You are given several axis-aligned rectangles. Compute the sum of the area of the regions that are covered 阅读全文
posted @ 2020-04-29 12:43 XXXSANS 阅读(264) 评论(0) 推荐(0)
摘要: Problem L — limit 1 second Liars There are n people in a circle, numbered from 1 to n, each of whom always tells the truth or always lies. Each person 阅读全文
posted @ 2020-04-29 10:49 XXXSANS 阅读(935) 评论(0) 推荐(0)
摘要: One of the first users of BIT's new supercomputer was Chip Diller. He extended his exploration of powers of 3 to go from 0 to 333 and he explored taki 阅读全文
posted @ 2020-04-28 16:58 XXXSANS 阅读(100) 评论(0) 推荐(0)
摘要: 在算法竞赛中,我们常常需要用到一个“无穷大”的值,对于我来说,大多数时间我会根据具体问题取一个99999999之类的数(显得很不专业啊!) 在网上看别人代码的时候,经常会看到他们把INF设为0x7fffffff,奇怪为什么设一个这么奇怪的十六进制数,一查才知道,因为这是32-bit int的最大值。 阅读全文
posted @ 2020-04-28 16:20 XXXSANS 阅读(297) 评论(0) 推荐(0)
摘要: After coding so many days,Mr Acmer wants to have a good rest.So travelling is the best choice!He has decided to visit n cities(he insists on seeing al 阅读全文
posted @ 2020-04-28 16:17 XXXSANS 阅读(168) 评论(0) 推荐(0)
摘要: You are given two integers aa and bb, and qq queries. The ii-th query consists of two numbers lili and riri, and the answer to it is the number of int 阅读全文
posted @ 2020-04-27 16:19 XXXSANS 阅读(328) 评论(0) 推荐(0)
摘要: kefa进入了一家餐厅,这家餐厅中有n个菜(0<n≤18),kefa对第i个菜的满意度为ai(0≤ai≤10^9),并且对于这n个菜有k个规则,如果kefa在吃完第xi个菜之后吃了第yi个菜(保证xi、yi不相等),那么会额外获得ci(0≤ci≤10^9)的满意度。kefa要吃m道任意的菜(0<m≤ 阅读全文
posted @ 2020-04-27 11:44 XXXSANS 阅读(121) 评论(0) 推荐(0)
上一页 1 ··· 55 56 57 58 59 60 61 62 63 ··· 68 下一页