摘要: import java.util.*; public class Test{ public static void main(String[] args) { int singlePrice=8; double[] discounts={1,0.95,0.9,0.8,0.75}; int[] nums={2,2,2,1,1}; ... 阅读全文
posted @ 2018-03-17 14:55 xinyilovestudy 阅读(197) 评论(0) 推荐(0) 编辑
摘要: 1.0-1背包 2.完全背包 3.多重背包 阅读全文
posted @ 2018-03-17 12:56 xinyilovestudy 阅读(250) 评论(0) 推荐(0) 编辑
摘要: import java.util.*; public class Main{ static int count; static int[] result; static int length; static int maxCount; public static void main(String[] args) { int[] nums... 阅读全文
posted @ 2018-03-16 21:28 xinyilovestudy 阅读(119) 评论(0) 推荐(0) 编辑
摘要: 1.假设可以用color种颜色,如果不满足则增大color的量 阅读全文
posted @ 2018-03-16 20:58 xinyilovestudy 阅读(151) 评论(0) 推荐(0) 编辑
摘要: 扩展版:上楼消耗K,下楼消耗1 阅读全文
posted @ 2018-03-16 18:06 xinyilovestudy 阅读(102) 评论(0) 推荐(0) 编辑
摘要: import java.util.*; public class Main{ public static void main(String[] args) { String s1="BBCABCDABABCDABCDABD"; String s2="ABCDABD"; int[] next=getNext(s2); ... 阅读全文
posted @ 2018-03-16 17:26 xinyilovestudy 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 307. Range Sum Query - Mutable 求两下标区间之间的和。 1. 利用树状数组来求解(https://www.cnblogs.com/hsd-/p/6139376.html)。 2.利用线段树求解 阅读全文
posted @ 2018-03-16 17:11 xinyilovestudy 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 1.逆序对(归并排序) 2.逆序对(离散化+树状数组) 3.逆序对(离散化+线段树) 阅读全文
posted @ 2018-03-16 17:05 xinyilovestudy 阅读(194) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://leetcode.com/problems/redundant-connection-ii/description/ 题目截图: 题目大意:给定一个二维数组代表一个有向图(数组中每个一维数组[A,B]代表由A指向B的边),图中共有N个结点(标号为1-N)和N条有向边,我们需 阅读全文
posted @ 2018-03-04 21:40 xinyilovestudy 阅读(580) 评论(0) 推荐(0) 编辑