题目链接:HDU 2410 Barbara Bennett's Wild Numbers
题意:给出两串数w,s(长度相同),第一串中有“?”,问“?”取的值使w对应的数大于s对应的数 的最大方案数。
思路:W,S一一对应比较;
遇到第一个’?‘之前比较情况
1.w[i]
2.w[i]>s[i] break。之后有n个‘’?‘ 方案数就有10的n次方种。
3.w[i]=s[i] 继续比...
分类:
Web程序 时间:
2014-10-04 11:45:16
阅读次数:
244
POJ 3340 & HDU 2410 Barbara Bennett's Wild Numbers(数学)...
分类:
Web程序 时间:
2014-10-03 20:53:15
阅读次数:
189
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1058解题报告:输入一个n,输出第n个质因子只有2,3,5,7的数。用了离线打表,因为n最大只有5842。 1 #include 2 #define INT __int64 3 INT ans[5850]...
分类:
其他好文 时间:
2014-10-02 21:50:53
阅读次数:
1042
本文翻译自stackoverflow,by:王奎问题:我有一个数组:[1,2,3,6,7, 8, 9,20, 22]我想让它对用户下面形式显示Numbers 1 through 3, 6 through 9, 20, 22以下是一个完整是程序:/** blog:http://www.marksaas...
分类:
其他好文 时间:
2014-10-02 13:26:42
阅读次数:
135
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 ...
分类:
其他好文 时间:
2014-10-02 02:34:02
阅读次数:
227
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 following triangle
[
[2],
[3,4],
[...
分类:
其他好文 时间:
2014-10-01 19:09:51
阅读次数:
144
题意:
给k(1
比如 1就是5 ,3就是55 ,4就是56
思路:
首先我们可以发现,一位数有2个这的数,两位数有4个,三位数有8个。。
那么我们可以通过统计确定出第k大的数是几位的。
通过累和,一位数以下0个,两位数以下2,三位数以下6
n位数以下就是2^n-2
然后给k,从大到下搜索第一个小于k的bit[i],那么就有i位数。
然后就是对于i位数,它是第几个数。
比如说k...
分类:
其他好文 时间:
2014-10-01 18:42:11
阅读次数:
137
Upon a homely object Love can wink.—William Shakespeare, The Two Gentlemen of VeronaThe simple types of JavaScript are numbers, strings, booleans (tru...
分类:
编程语言 时间:
2014-10-01 15:31:31
阅读次数:
351
Problem:Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of th...
分类:
其他好文 时间:
2014-09-30 23:33:10
阅读次数:
319