Add BinaryGiven two binary strings, return their sum (also a binary string).For example,a ="11"b ="1"Return"100".算法思路:模拟二进制加法,跟十进制木有区别,将a,b转置(不转置的话,倒着...
分类:
其他好文 时间:
2014-07-24 22:57:23
阅读次数:
216
题目链接做题的时候凑的规律,其实可以 用式子推一下的。题意:n对数,每对数有e,k, 按照题目的要求(可以看下面的Hint就明白了)求最小的值。分析:假设现在总的是sum, 有两个e1 k1 e2 k2则先选e1 为 (sum+e1)*k1+(sum+e1+e2)*k2先e2: (sum+e2)*k...
分类:
其他好文 时间:
2014-07-24 22:51:53
阅读次数:
179
create or replace function F01_SX03_SUM(statdate varchar2, code varchar2, ...
分类:
数据库 时间:
2014-07-24 22:46:03
阅读次数:
188
Two Sum 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 t...
分类:
其他好文 时间:
2014-07-24 22:32:52
阅读次数:
194
#include#include#define Max 10000000int map[110][110],cost[110],vit[110],m,n;void prim(int x){ int i,j,min,k,sum=0; memset(vit,0,sizeof(vit)); for(i=1...
分类:
其他好文 时间:
2014-07-24 22:05:32
阅读次数:
213
1 PROC PRINT DATA=data-set NOOBS LABEL;2 BY Variable-list;/*需提前排序,对每个BY变量输出,且在每页顶部打印该页By变量名*/3 ID Variable-list;/*不打印出观测值,且放在最左边*/4 SUM Varia...
分类:
其他好文 时间:
2014-07-24 21:42:32
阅读次数:
309
Given an arraySofnintegers, find three integers inSsuch that the sum is closest to a given number, target. Return the sum of the three integers. You m...
分类:
其他好文 时间:
2014-07-24 21:36:52
阅读次数:
172
Given an arraySofnintegers, are there elementsa,b,cinSsuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.Note:Elemen...
分类:
其他好文 时间:
2014-07-24 21:24:16
阅读次数:
296
同上题一样,求连续子序列的最大和而且比上题还要简单一些,用不到long long了直接水过 1 //#define LOCAL 2 #include 3 #include 4 #include 5 using namespace std; 6 7 const int maxn = 10000...
分类:
其他好文 时间:
2014-07-24 14:47:45
阅读次数:
271
Milliard Vasya's Function
大意:
求1到10^9之间的数中,各数位和为s的数的个数。
思路:
dp[i][j]表示位数是i的数字各个位之和为j的数的个数(1
先DP出1到9 位数上各位之和的个数,(dp[i][j] = dp[i-1][j]+sum(dp[i-1][j-1], dp[i-1][j-2]......., dp[i-1][...
分类:
其他好文 时间:
2014-07-24 11:35:52
阅读次数:
255