Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.N...
分类:
其他好文 时间:
2014-08-25 20:41:44
阅读次数:
192
http://acm.timus.ru/problem.aspx?space=1&num=1586
题意没看懂,看了别人的翻译。threeprime number的意思是任意三个连续的数组成的一个三位数是素数,注意必须是三位数。给出n,问满足条件的n位数有多少个。
先把三位数的素数筛选出来并标记,设dp[i][j][k]表示到i位为止,最后两位是j和k的满足条件的数的个数。
...
分类:
其他好文 时间:
2014-08-25 19:15:44
阅读次数:
161
这是题目的答案#include#includeusing namespace std;int a[45002];int b[45002];int mod(int a, int b, int c){ int z = 1; while(b) { if(b%2) ...
分类:
其他好文 时间:
2014-08-25 13:20:14
阅读次数:
132
题目链接The problem is quite simple. You're given a number N and a positive integer K. Tell if N can be represented as a sum of K prime numbers (not neces...
分类:
其他好文 时间:
2014-08-25 13:19:04
阅读次数:
270
Problem 34
145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 = 145.
Find the sum of all numbers which are equal to the sum of the factorial of their digits.
Note: as 1! = 1 and 2! = 2 are...
分类:
其他好文 时间:
2014-08-25 11:59:14
阅读次数:
243
Problem 36
The decimal number, 585 = 10010010012 (binary), is palindromic in both bases.
Find the sum of all numbers, less than one million, which are palindromic in base 10 and base 2.
(Please...
分类:
其他好文 时间:
2014-08-25 10:06:04
阅读次数:
198
思想: 简单的深度优先搜索。
思想: 动态规划:
n = s.length();
Record[i] = 0 , ( i = n || is...
分类:
其他好文 时间:
2014-08-25 02:17:23
阅读次数:
187
Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.The same repeate...
分类:
其他好文 时间:
2014-08-24 23:34:33
阅读次数:
259
Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.Each numb...
分类:
其他好文 时间:
2014-08-24 23:29:33
阅读次数:
176
LeetCode: Palindrome PartitionGiven a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome ...
分类:
其他好文 时间:
2014-08-24 19:21:22
阅读次数:
196