Given a triangle, find the minimum path sum from
top to bottom. Each step you may move to adjacent numbers on the row below.For
example, given the fol...
分类:
其他好文 时间:
2014-05-08 21:08:25
阅读次数:
407
练习题(这里贴的是自己写的代码,
网上给的题目代码我会附加在最下面)1.编写shell脚本,计算1-100的和; 1 #!/bin/bash 2 #caculate the sum of
numbers from 1 to 100 3 4 sum=0 5 for i in `seq 1 100`;....
分类:
其他好文 时间:
2014-05-07 19:34:54
阅读次数:
305
Problem:In the 2020 grid below, four numbers
along a diagonal line have been marked in red.08 02 22 97 38 15 00 40 00 75 04
05 07 78 52 12 50 77 91 08...
分类:
其他好文 时间:
2014-05-06 14:35:55
阅读次数:
460
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
We consider permutations of the numbers 1,..., N
for some N. By permutation we mean a rearrangment of the
number 1,...,N. For example
2 4 5 1 7 6 3 8
is a permutation of 1,2,...,8. Of cours...
分类:
其他好文 时间:
2014-05-04 18:38:14
阅读次数:
341
Given a collection of numbers that might
contain duplicates, return all possible unique permutations.For
example,[1,1,2]have the following unique perm...
分类:
其他好文 时间:
2014-05-04 10:20:44
阅读次数:
240
给定一个数,求一个新数要大于等于这个数,而这个新数既要是palindromes回文又要是prime素数。
题目很简单,有人都使用取巧的方法保存好结果直接查表。
或者暴力法求解。
这里不使用保存表的方法,也不要用暴力法。- 这些方法都不好。
使用的技巧有:
1 而是使用next palindrome的技巧,只需要O(n),n是数位,可以认为是常数了。
2 判断素数的方法,时间效率是O(s...
分类:
其他好文 时间:
2014-05-04 09:18:17
阅读次数:
334
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