上一页 1 ··· 3 4 5 6 7 8 9 10 下一页
摘要: 今天碰到要处理0~1000000000的数字,因此查到可以使用BigDecimal。 1.BigDecimal构造方法 1.public BigDecimal(double val) 将double表示形式转换为BigDecimal *不建议使用 2.public BigDecimal(int va 阅读全文
posted @ 2019-02-15 16:41 DXYE 阅读(204) 评论(0) 推荐(0)
摘要: 1 import java.util.Scanner; 2 public class Test5 { 3 public static int res=1061109567; 4 public static int n,m; 5 public static int[][] gra; 6 public static int[][] cun; 7 ... 阅读全文
posted @ 2019-02-15 15:29 DXYE 阅读(1441) 评论(0) 推荐(0)
摘要: 思路:使用并查集,首先格子中的每个数都以自己为根节点(此时共有m*n个集合),然后根据输入的k个数据将其连通(当两个数的根节点不一样,则说明可以连通,否则说明已在一个集合中),每次连通将集合数减1。 阅读全文
posted @ 2019-02-14 16:44 DXYE 阅读(412) 评论(0) 推荐(0)
摘要: 思路:该题要使用树的直径。 求树的直径:先从一个点DFS,找到一个最远的点v,然后以该点v作为起点再次DFS,找到点t,则v到t则为该树的最远直径。 阅读全文
posted @ 2019-02-13 10:37 DXYE 阅读(221) 评论(0) 推荐(0)
摘要: 思路:使用深搜找出每条从start到end的路径,然后计算每条路径中的每个点经过的次数。如果一个点经过的次数等于路径数,那么则说明该点是关键必经点。 阅读全文
posted @ 2019-02-12 11:44 DXYE 阅读(429) 评论(0) 推荐(0)
摘要: 思路:输入n,m两数(n<m),先将1~m的数字添加到List中,然后从幸运数2开始,将2到List.size()大小的数字中的下标能被幸运数2整取的数字添加到 一个名为remove的List中,然后将remove中的数字作为list中的下标将list中对应的数字删除。 阅读全文
posted @ 2019-02-11 17:00 DXYE 阅读(1238) 评论(0) 推荐(0)
摘要: 参考博文:https://blog.csdn.net/zhaohaibo_/article/details/79544497 问题描述 小明开了一家糖果店。他别出心裁:把水果糖包成4颗一包和7颗一包的两种。糖果不能拆包卖。 小朋友来买糖的时候,他就用这两种包装来组合。当然有些糖果数目是无法组合出来的 阅读全文
posted @ 2019-02-10 16:59 DXYE 阅读(639) 评论(0) 推荐(0)
摘要: Given an array of n positive integers and a positive integer s, find the minimal length of a contiguoussubarray of which the sum ≥ s. If there isn't o 阅读全文
posted @ 2019-02-10 11:53 DXYE 阅读(143) 评论(0) 推荐(0)
摘要: Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n). Example: Note: If there i 阅读全文
posted @ 2019-02-09 20:44 DXYE 阅读(199) 评论(0) 推荐(0)
摘要: Given n, how many structurally unique BST's (binary search trees) that store values 1...n? For example,Given n = 3, there are a total of 5 unique BST' 阅读全文
posted @ 2019-02-08 23:52 DXYE 阅读(135) 评论(0) 推荐(0)
上一页 1 ··· 3 4 5 6 7 8 9 10 下一页