代码如下:
#include
#include
double
dis(double
x1, double y1,
double x2,
double y2)
{
return
sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2));
}
double
v1, v2, v3, x[4], y[4];...
分类:
其他好文 时间:
2014-05-22 12:09:29
阅读次数:
247
#include//??????????С???? ? С????
#include
using namespace std;
int lfh(int n)
{
return (n*(n+1)/2)*(n*(n+1)/2);
}
unsigned int js(int n)
{
unsigned int ms=0;
unsigned int sum=0;
uns...
分类:
其他好文 时间:
2014-05-22 12:08:06
阅读次数:
245
简介
List是一种可在常数时间内在任何位置执行插入和删除操作的顺序容器。list是双向链表,其迭代器是双向的。与其他顺序容器(array, vector, deque)相比,list容器在任意位置执行插入、提取、和移动元素的操作更高效,但它不能通过在容器中的位置直接获取元素。
成员函数
复制控制
list::list()
...
分类:
编程语言 时间:
2014-05-22 11:44:49
阅读次数:
433
【题目】
Suppose a sorted array is rotated at some pivot unknown to you beforehand.
(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).
You are given a target value to search. If found in the array return its index, otherwise return -1.
You may assume no du...
分类:
其他好文 时间:
2014-05-22 10:43:12
阅读次数:
310
import cv2
import numpy
import os
# Make an array of 120,000 random bytes.
randomByteArray = bytearray(os.urandom(120000))
flatNumpyArray = numpy.array(randomByteArray)
# Convert the array to make a ...
分类:
编程语言 时间:
2014-05-22 08:41:08
阅读次数:
353
8.7 列表工具
许多数据结构需求能通过内置列表类型满足,但是,有时处于不同性能取舍需要从中选择一种实现。
Array模块能提供一个像列表的array对象,它仅仅能存储同类数据并且更加简洁。接下来例子展示了一个数字数组。存储是2个字节的无标识的二进制数据而不是在python对象中普通列表中的每个16字节的值。
>>> from array import array
>>> a = arra...
分类:
编程语言 时间:
2014-05-22 07:46:06
阅读次数:
362
最近一直在看并发编程网,这篇文章先记录下这个地方的理解。
上下文环境移步CopyOnWriteArrayList类set方法疑惑?
[java] view
plaincopyprint?
/** The array, accessed only via getArray/setArray. */
private volatile tr...
分类:
其他好文 时间:
2014-05-22 07:11:36
阅读次数:
268
【题目】
Given a sorted array of integers, find the starting and ending position of a given target value.
Your algorithm's runtime complexity must be in the order of O(log n).
If the target is not found in the array, return [-1, -1].
For example,
Given [5...
分类:
其他好文 时间:
2014-05-22 06:44:39
阅读次数:
265
#include
using namespace std;
int func(int year)//判断闰年的个数
{
int count=0;
for(int i=1990;i
if(year%4==0&&year%100!=0||year%400==0)
count++;
return cou...
分类:
其他好文 时间:
2014-05-22 06:34:15
阅读次数:
252
public class GameTree {
/**
* 判断剩余球数,谁能取到最后谁赢,
* ,一人取一次,默认我方先取,,能否必胜,能就返回true,否则false
* @param x剩余球数
* @return
*/
static boolean f(int x){
int[] op={1,3,7,8};//每次取球只能有四种情况
for(int i=0;i
if (...
分类:
其他好文 时间:
2014-05-20 14:09:29
阅读次数:
263