"题目" 题意:找到一个数组里第K大的数字。 题解:我们当然可以排序好了,之后,选择第K大的数字。但是这样做一点技术含量也没有。 排序算法选用快排。寻找第K大的数字,不必把数组完全排完序之后,再找第K大。快排中是选取一个数字,把大于它的放在右边,小于它的放在左边,在递归的时候,我们判断k 和右边数字 ...
分类:
编程语言 时间:
2020-02-22 13:39:48
阅读次数:
58
前面几章介绍了处理适量适中的图形内容的最佳方法。通过使用几何图形、图画和路径,可以降低2D图形的开销。即使正在使用复杂的具有分层效果的组合形状和渐变画刷,这种方法也仍然能够正常得很好。 然而,这样设计不适合需要渲染大量图形元素的绘图密集型应用程序。例如绘图程序、演示粒子碰撞的物理模型程序或横向卷轴形 ...
话不多说上代码 package 滑稽快闪; import java.awt.Graphics;import java.awt.Image;import java.awt.Rectangle; /* * 游戏物体父类 */public class gameObject { Image img; dou ...
分类:
编程语言 时间:
2020-02-18 20:37:54
阅读次数:
101
PAT 甲级 Advanced 1094 The Largest Generation (25) [BFS,DFS,树的遍历] ...
分类:
其他好文 时间:
2020-02-18 11:31:32
阅读次数:
82
Largest product in a series The four adjacent digits in the 1000 digit number that have the greatest product are 9 × 9 × 8 × 9 = 5832. Find the thirte ...
分类:
其他好文 时间:
2020-02-17 20:16:02
阅读次数:
145
Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. Example: Inpu ...
分类:
其他好文 时间:
2020-02-17 19:59:09
阅读次数:
80
Largest product in a grid In the 20×20 grid below, four numbers along a diagonal line have been marked in red. 08 02 22 97 38 15 00 40 00 75 04 05 07 ...
分类:
其他好文 时间:
2020-02-17 19:50:33
阅读次数:
116
Largest palindrome product A palindromic number reads the same both ways. The largest palindrome made from the product of two 2 digit numbers is 9009 ...
分类:
其他好文 时间:
2020-02-17 18:15:39
阅读次数:
102
Largest prime factor The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? 最大质因数 13195的所有质因数为5 ...
分类:
其他好文 时间:
2020-02-17 18:06:08
阅读次数:
105
Pavel loves grid mazes. A grid maze is an n?×?m rectangle maze where each cell is either empty, or is a wall. You can go from one cell to another only ...
分类:
其他好文 时间:
2020-02-17 12:32:11
阅读次数:
113