代码如下:
#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
【题目】
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
【题目】
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.
You may assume no duplicates in the array.
Here are few examples.
[1,3,5,6], 5 → 2
[1,3,5,6]...
分类:
其他好文 时间:
2014-05-22 09:41:59
阅读次数:
195
找出单词的最长公共前缀
class Solution {
public:
string longestCommonPrefix(vector &strs) {
int len=strs.size();
if(len==0)
return "";
int length=strs[0].size(),j;
...
分类:
其他好文 时间:
2014-05-22 09:35:20
阅读次数:
230
代码a
#include
#define maxn 1005
int
a[maxn];
int
dp[maxn];
int
max(int x,int
y)
{
return
x>y?x:y;
}
int
main()
{
int
t,n;
scanf("%d",&t);...
分类:
其他好文 时间:
2014-05-22 09:16:47
阅读次数:
192
【题目】
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
window["MzBrowser"]={};(function()
{
if(MzBrowser.platform) return;
var ua = window.navigator.userAgent;
MzBrowser.platform = window.navigator.platform;
MzBrowser.firefox = ua.indexOf("Firefox")>0;
Mz...
分类:
编程语言 时间:
2014-05-20 14:38:05
阅读次数:
239
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