1 #include 2 using namespace std; 3 double calculate(double x ,double y ,double (*pf[3])(double,double)); 4 double add(double x ,double y); 5 double ....
分类:
编程语言 时间:
2014-10-30 16:58:43
阅读次数:
222
Problem DescriptionGiven a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7)...
分类:
其他好文 时间:
2014-10-30 13:21:42
阅读次数:
276
http://acm.hdu.edu.cn/showproblem.php?pid=4135
求连续区间[a,b]内与n互质的数的个数。
因为a,b相当大,考虑用容斥原理。只需先求出[a,b]内与n不互质的数的个数,等于[1,b]内与n不互质的个数 - [1,a-1]内与n不互质的个数。问题转化为求【1,m】内与n不互质的数的个数。
先对n分解质因子,[1,m]内是n的质因子的倍数的...
分类:
其他好文 时间:
2014-10-30 00:27:50
阅读次数:
266
Problem DescriptionCalculate S(n).S(n)=13+23+33+......+n3.InputEach line will contain one integer N(1 // 运用数学公式:13 +23 +33 +……+n3 =[n(n+1)/2]2 2 3...
分类:
其他好文 时间:
2014-10-29 18:29:40
阅读次数:
157
var tot,i,j,k,m,n:longint; prime:array[0..100000] of boolean; p:array[0..100000] of longint;begin read(n); fillchar(prime,sizeof(prime),true); p...
分类:
其他好文 时间:
2014-10-28 21:13:10
阅读次数:
174
C++ Primer第五版这本书是久负盛名的C++经典教程,本篇博文为C++Primer(第五版)中文版第五章课后编程习题解答。...
分类:
编程语言 时间:
2014-10-28 17:56:31
阅读次数:
281
考虑一个问题:A^x%p=B,给定A,B,p,求x的最小非负整数解。
在p是质数的情况下,这个问题比较简单。
A^x=B(mod P) (P is a Prime, A,B
Let m = floor(sqrt(P))
Put A^0,A^1,...A^(m-1) into HashSet(You Can Also Use Map in STL),for Example M[A^i]=i....
分类:
编程语言 时间:
2014-10-28 13:55:30
阅读次数:
271
1,expra)expr calculate//a=10;echo `expr $a - 1 `b)string index //a='abcde';echo `expr index $a "b"`|| string substr// a='abcde'; echo `expr substr $a ...
分类:
系统相关 时间:
2014-10-28 12:07:51
阅读次数:
270
素数判定模板。 1 #include 2 #include 3 using namespace std; 4 int a[2001],ans=-2147483647,l,r,n,sum[2001]; 5 bool is_prime(const int &x) 6 { 7 for(int i=...
分类:
其他好文 时间:
2014-10-27 12:17:56
阅读次数:
172
Solution: when see question about two strings , DP should be considered first.We can abstract this question to calculate appear times for string T wit...
分类:
其他好文 时间:
2014-10-26 00:12:57
阅读次数:
211