You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a link...
分类:
其他好文 时间:
2014-05-23 07:43:23
阅读次数:
246
题目链接:11481 - Arrange the Numbers
题意:序列1-n,进行重排,问最后前m个中有k个仍然位置不变的情况数
思路:之前写过UVA 580, n个数重排,要求每个位置都不同的情况的题目,递推式为dp[i] = (i - 1) * (dp[i - 1] + dp[i - 2])
利用这个,这题只要:
k个位置C(m, k) * sum(C[n - m][i] (后面...
分类:
其他好文 时间:
2014-05-22 10:45:52
阅读次数:
191
??
Terrible Sets
Time Limit: 1000MS
Memory Limit: 30000K
Total Submissions: 2999
Accepted: 1549
Description
Let N be the set of all natural numbers {0 , 1 , 2 , . . . ...
分类:
其他好文 时间:
2014-05-22 09:52:10
阅读次数:
283
1 使用First()/FirstOrDefault()、Last()/LastOrDefault()方法返回序列中的第一个或者最后一个元素时,应该确保序列已经被正确排序。
int[] numbers = { 3, 1, 23, 10, 5, 12, 7, 2, 4};
int first = numbers.First(); //输出3
int firstOrdered = numbers.O...
分类:
其他好文 时间:
2014-05-22 07:35:10
阅读次数:
196
Find 2 numbers with given sum in sorted array.
分类:
其他好文 时间:
2014-05-22 01:53:17
阅读次数:
288
Find a number which appears once in an array with
all the other numbers appear twice.
分类:
其他好文 时间:
2014-05-22 01:08:40
阅读次数:
278
Reorder an array so that odd numbers come
before even numbers.
分类:
其他好文 时间:
2014-05-22 00:38:39
阅读次数:
259
【题目】
Write a program to solve a Sudoku puzzle by filling the empty cells.
Empty cells are indicated by the character '.'.
You may assume that there will be only one unique solution.
A sudoku puzzle...
...and its solution numbers marked in red.
...
分类:
其他好文 时间:
2014-05-20 17:07:34
阅读次数:
335