# Definition for a binary tree node# class
TreeNode:# def __init__(self, x):# self.val = x# self.left = None# self.right
...
分类:
其他好文 时间:
2014-05-05 22:56:23
阅读次数:
419
Link:http://oj.leetcode.com/problems/swap-nodes-in-pairs/Given a linked list,
swap every two adjacent nodes and return its head.For example,Given1->2-...
分类:
其他好文 时间:
2014-05-05 22:45:37
阅读次数:
331
Problem
Link:http://oj.leetcode.com/problems/word-ladder/Two typical techniques are
inspected in this problem:Hash Table. One hash set is the words di...
分类:
其他好文 时间:
2014-05-05 22:44:44
阅读次数:
393
Implement next permutation, which rearranges
numbers into the lexicographically next greater permutation of numbers.If such
arrangement is not possibl...
分类:
其他好文 时间:
2014-05-05 22:19:17
阅读次数:
312
Input
t – the number of numbers in list, then t lines follow [t
Each line contains one integer: N [0 N
Output
Output given numbers in non decreasing order.
Example
Input:
5
5
3
...
分类:
其他好文 时间:
2014-05-04 00:04:09
阅读次数:
376
Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets
so as the following conditions hold:
The product of all numbers in the first set is less ...
分类:
其他好文 时间:
2014-05-03 23:51:19
阅读次数:
621
Let's consider a triangle of numbers in which a number appears in the first line, two numbers appear in the second line, three in the third line, etc. Develop a program which will compute the largest ...
分类:
其他好文 时间:
2014-05-03 17:32:22
阅读次数:
284
The game of billiards involves two players knocking 3 balls around
on a green baize table. Well, there is more to it, but for our
purposes this is sufficient.
The game consists of several rounds ...
分类:
其他好文 时间:
2014-05-03 16:15:33
阅读次数:
296
本题就是测试读入数据的速度的。
如果有大量的数据读入,使用cin是很慢的。
那么使用scanf那么会快很多,但是如果数据量更大的话那么就还是不够快了。
所以这里使用fread。
首先开一个buffer,然后使用fread大块大块地读入数据就可以非常快地读入了。
题目如下:
Input
The input begins with two positive...
分类:
其他好文 时间:
2014-05-03 16:13:21
阅读次数:
340
#include
#include
#include
#include
#include
using namespace std;
#define N 20020
struct node{
int from, to, dou, nex;
}edge[N];
int head[N], edgenum;
void add(int u, int v,int dou){
node E={u,v,dou...
分类:
其他好文 时间:
2014-05-03 15:25:32
阅读次数:
340