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-05-16 23:18:16
阅读次数:
360
1 #include 2 #include 3 using namespace std; 4
5 int main() 6 { 7 int n; 8 double max,min,sum,aver; 9 double a[110] = {0};10
while...
分类:
其他好文 时间:
2014-05-16 22:47:35
阅读次数:
452
one two three four five six seven eight
分类:
Web程序 时间:
2014-05-16 20:49:04
阅读次数:
340
Givennnon-negative integersa1,a2, ...,an, where
each represents a point at coordinate (i,ai).nvertical lines are drawn such that
the two endpoints of ...
分类:
其他好文 时间:
2014-05-16 19:42:17
阅读次数:
286
http://acm.hdu.edu.cn/showproblem.php?pid=4635问:最多加多少条边,使得原图不是强连通图正向考虑有困难,不妨反向思考,既最少去掉几条边使得原图不是强连通。总边数sum=n*(n-1)时肯定是强连通,已经给了m条边,sum-=m这时把已经强连通的部分进行缩点...
分类:
其他好文 时间:
2014-05-14 13:37:36
阅读次数:
335
令\[S_i=\sum_{k=1}^n k^i
m^k\]我们有\[\begin{eqnarray*}(m-1)S_i & = & mS_i - S_i \\& = &
\sum_{k=1}^n k^i m^{k+1} - \sum_{k=1}^n k^i m^k \\& = & \sum_{k=2...
分类:
其他好文 时间:
2014-05-14 10:45:13
阅读次数:
357
观察可以发现,0,1,2,……,n结尾的分组中,maxsum a[0] = a[0]maxsum
a[1] = max( a[0] + a[1] ,a[1]) = max( maxsum a[0] + a[1] ,a[1])maxsum a[2] =
max( max ( a[0] + a[1] +...
分类:
其他好文 时间:
2014-05-14 08:38:58
阅读次数:
323
题目链接:1350 - Pinary
题意:二进制数,不能有连续的1,给定第n个数字,输出相应的二进制数
思路:先是递推,求出由n位组成的数字中有几个满足条件
dp[i] = dp[i - 1] + dp[i - 2],考虑最后一位放0和倒1位放0的情况。
然后用一个sum[i]记录满足
接着利用二分找到给定的n > sum[i - 1],i的最大值,这个就是所求的答案的最高位。
因为...
分类:
其他好文 时间:
2014-05-13 14:10:44
阅读次数:
246
题意很简单,求sum(gcd(i,n)) 1
这题看到后第一反应并没有里用积性函数的性质,不过也可以做,欣慰的是我反应还是比较快的
设f(n)=gcd(1,n)+gcd(2,n)+....+gcd(n-1,n) + gcd(n,n),
用g(n,i)表示满足 gcd(x,n)=i的 x的个数 (x小于n),则 f(n)=sum{i*g(n,i)};
同时又利用 扩展欧几里德的性...
分类:
其他好文 时间:
2014-05-13 13:40:58
阅读次数:
365
Prime Ring Problem
Problem Description
A ring is compose of n circles as shown in diagram. Put natural number 1, 2, ..., n into each circle separately, and the sum of numbers in two adjacent...
分类:
其他好文 时间:
2014-05-13 11:54:17
阅读次数:
444