ICPC Asia Urumqi 2017 B.The Difference


Alice was always good at math. Her only weak points were multiplication and subtraction. To help her with that, Bob presented her with the following problem. He gave her four positive integers. Alice can change their order optionally. Her task is to find an order, denoted by A1,A2,A3 and A4, with the maximum value of A1×A2 − A3×A4. Input The input…
阅读更多 ➜

ICPC Asia Urumqi 2017 G.The Mountain


All as we know, a mountain is a large landform that stretches above the surrounding land in a limited area. If we as the tourists take a picture of a distant mountain and print it out, the image on the surface of paper will be in the shape of a particular polygon. From mathematics angle we can describe the range of the mountain in the picture as a list of…
阅读更多 ➜

Leecode.1.Two Sum (两数之和)


题目描述: LeetCode第一题,两数之和 Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use the same element twice. Example: Given nums = [2, 7, 11, 15], target…
阅读更多 ➜

LeetCode-1128-Number of Equivalent Domino Pairs(等价多米诺骨牌对的数量)


题目描述: Given a list of dominoes, dominoes[i] = [a, b] is equivalent to dominoes[j] = [c, d] if and only if either (a==c and b==d), or (a==d and b==c) - that is, one domino can be rotated to be equal to another domino. Return the number of pairs (i, j) for which 0 <= i < j < dominoes.length, and dominoes[i] is equivalent to dominoes[j]. Example…
阅读更多 ➜

Java中的二进制


Java SE 7之后可以使用二进制来定义byte,short,int,long这些整型变量。要使用二进制来表示整形,需要在数字开头带上0b或者0B,如…
阅读更多 ➜

Java8的Lambda表达式与类型检查、推断及限制


为了全面了解Lambda表达式,我们应该知道Lambda的实际类型是什么。 类型检查 Lambda的类型**是从使用Lambda的上下文推断出来…
阅读更多 ➜