问题描述:
A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.
Return a deep copy of the list.
解题思路:
将1->2->3->4->NUL...
分类:
其他好文 时间:
2014-07-30 10:07:54
阅读次数:
259
先判断是否在圆内,然后用叉积判断是否在180度内。枚举判断就可以了。。。感觉是数据弱了。。#include #include #include #include #include using namespace std;const double eps=0.00000001;struct point...
分类:
其他好文 时间:
2014-07-30 00:25:52
阅读次数:
292
首先求多边形面积,这个比较简单,用的就是把一个多边形划分为多个三角形,然后求三角形面积。
代码:double Cross(Vector A,Vector B) { return (A.x*B.y-A.y*B.x); }
double ConvexPolygonArea(Point* p,int n)//多边形面积,,点按顺序
{
double area=0;
for(int i=...
分类:
其他好文 时间:
2014-07-29 17:50:32
阅读次数:
220
Description
Farmer John is leaving his house promptly at 6 AM for his daily milking of Bessie. However, the previous evening saw a heavy rain, and the fields are quite muddy. FJ starts at the point...
分类:
其他好文 时间:
2014-07-29 17:47:12
阅读次数:
247
可以证明O是三角形ABC的垂心。作图辅助线,一个很重要的技巧是延长中线等中线。可以证明三角形DNA全等于ABC。然后通过角度变换容易证明AQ垂直于BC。#include #include #include using namespace std;struct point{ double x,y;}A...
分类:
其他好文 时间:
2014-07-29 17:15:32
阅读次数:
264
一些成员函数改变对象,一些成员函数不改变对象。例如:int Point::GetY(){ returnyVal;} 这个函数被调用时,不改变Point对象,而下面的函数改变Point对象:void Point:: SetPt (int x, int y){ xVal=x; yVal=y;} 为了.....
分类:
编程语言 时间:
2014-07-29 16:46:22
阅读次数:
198
4-point polyline
大意:给你一个网格,从(0, 0)到(n, m)。在网格中选出4个不相同的点,按序相连成3段,求3段想加之和最长的情况是什么,输出这种情况。
思路:当时做的时候各种蛋疼,主要是没想对方向,导致一直WA在第3组。今天看到了一个比较清晰的思路。
首先,确定一个短边,我取了m为较短边。
然后情况主要是分3种:
1.当短边...
分类:
其他好文 时间:
2014-07-29 14:36:38
阅读次数:
158
1 package leetcode; 2 3 import java.util.HashMap; 4 5 class Point{ 6 int x; 7 int y; 8 Point(){ 9 x=0;10 y=0;11 }12...
分类:
其他好文 时间:
2014-07-29 14:09:58
阅读次数:
248
21点游戏,命令行的,面像过程的写法。ruby 的写法以后再试试。
# this is game 21 point
# 操作命令符 空没有操作,n下一步,抽牌;w亮牌结束;l认输
$ope = ''
$prompt = '>'
$x1 = 0
$x2 = 0
$x3 = 0
$pc = 0
$u1 = 0
$u2 = 0
$u3 = 0
$over = ''
def out_main(a = ...
分类:
其他好文 时间:
2014-07-29 12:52:27
阅读次数:
212
可以通过顶角角度来计算切线与坐标轴的坐标开始还以为有公式可以算,谁知道原来是解二元一次方程,靠。。#include #include #include #include using namespace std;const int MAX=1050;struct point{ double x; in...
分类:
其他好文 时间:
2014-07-29 11:44:26
阅读次数:
225