今天手残,碰了一道leetcode HARD难度题目,果然来着不善,花了不少时间,题目很简单,求平面内一些离散点中,最大共线点的数量。最直接的思路就是通过斜率判断,但是考虑到斜率很可能是小数,比较小数的大小会有误差,因此我们不做除法,取横纵坐标差值的最大公约数,然后横纵坐标分别除以最大公约数即可,这 ...
分类:
其他好文 时间:
2018-04-03 23:44:22
阅读次数:
266
gdk_draw_line () gdk_draw_rectangle () gdk_draw_arc () gdk_draw_polygon () gdk_draw_string () gdk_draw_text () gdk_draw_pixmap () gdk_draw_bitmap () g ...
分类:
系统相关 时间:
2018-04-02 01:07:12
阅读次数:
601
题目连接:http://poj.org/problem?id=1860 Description Several currency exchange points are working in our city. Let us suppose that each point specializes i ...
分类:
其他好文 时间:
2018-03-30 19:56:51
阅读次数:
148
昨晚打了第一场atcoder...这题卡了1h...今天听课的时候听到了一个极相似的题。。。 题意:给出2n个点的坐标(x,y) 前n个是红点,剩下是蓝点,当一个红点的横纵坐标都小于一个蓝点的时候,他们可以匹配,求最大的匹配对数 按照横坐标排序,排序后从右往左扫描,发现蓝点将其纵坐标存入set中(因 ...
分类:
其他好文 时间:
2018-03-18 16:26:45
阅读次数:
262
Description One steps through integer points of the straight line. The length of a step must be nonnegative and can be by one bigger than, equal ...
分类:
其他好文 时间:
2018-03-17 23:24:34
阅读次数:
212
The Question SuperUser reader Sagnik Sarkar wants to know what the difference between 127.0.0.1 and 0.0.0.0 is: I understand that 127.0.0.1 points to ...
分类:
其他好文 时间:
2018-03-14 16:55:58
阅读次数:
180
写在前面,四叉树和八叉树就是2D和3D的“二分法”,搜索过程与二叉树搜索也类似,二叉树中是将数组sort后存入二叉树中,从而在查找中实现时间复杂度为log2;四叉树/八叉树是按平面/空间范围划分有序node,将所有points(坐标已知)放入所属node中,实现所有points的sort,进而在搜索 ...
分类:
其他好文 时间:
2018-03-10 00:20:15
阅读次数:
313
The teacher points to the blackboard (Fig. 4) and says: "So here is the problem: There are three towers: A, B and C. There are n disks. The number n i ...
分类:
其他好文 时间:
2018-03-06 17:14:32
阅读次数:
198
C - March Time limit : 2sec / Memory limit : 256MB Score : 300 points Problem Statement There are N people. The name of the i-th person is Si. We woul ...
分类:
其他好文 时间:
2018-03-04 23:00:15
阅读次数:
246
答案就是 $3+2 \times \sum_{i=2}^n \varphi(i)$,记得特判 cpp include include using namespace std; int n, T, phi[1005]; void shai(){ for(int i=1; i T; for(int i= ...
分类:
其他好文 时间:
2018-03-04 22:56:47
阅读次数:
211