题意:
f(n)=(∏i=1nin?i+1)%1000000007
You are expected to write a program to calculate f(n) when a certain n is given.
思路:
写出前几项,就很容易得出递推式。但是因为n的数据范围是1~10000000,而内存给的小
,所以并不能直接打表(MLE)
采用离线处理——...
分类:
其他好文 时间:
2015-05-12 18:50:38
阅读次数:
117
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), the ma...
分类:
其他好文 时间:
2015-05-12 18:44:10
阅读次数:
129
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)...
分类:
其他好文 时间:
2015-05-12 15:18:08
阅读次数:
89
How many prime numbersTime Limit: 1000msMemory Limit: 32768KBThis problem will be judged onHDU. Original ID:213864-bit integer IO format:%I64d Java cl...
分类:
其他好文 时间:
2015-05-12 13:17:52
阅读次数:
102
#include
#include
#include
#include
using namespace std;
const int Max = 40;
bool prime[Max];
bool vis[Max];
int A[Max];
int n;
void IsPrime() {
prime[0] = prime[1] = 0; prime[2] = 1;
for(i...
分类:
其他好文 时间:
2015-05-11 21:51:44
阅读次数:
121
ZOJ 3772 Calculate the Function(线段树+矩阵)...
分类:
其他好文 时间:
2015-05-11 18:00:01
阅读次数:
132
Problem DescriptionA simple mathematical formula for e iswhere n is allowed to go to infinity. This can actually yield very accurate approximations o....
分类:
其他好文 时间:
2015-05-11 17:42:01
阅读次数:
100
题目描述:
Description:
Count the number of prime numbers less than a non-negative number, n
click to show more hints.
思路:利用厄拉多塞筛法。具体操作:先将 2~n 的各个数放入表中,然后在2的上面画一个圆圈,然后划去2的其他倍数;第一个既未画圈又没有被划去的数是3,将它画圈,...
分类:
其他好文 时间:
2015-05-11 16:08:03
阅读次数:
126
Problem Description
Tom has learned how to calculate the number of inversions in a permutation of n distinct objects by coding, his teacher gives him a problem:
Give you a permutation of n distinct i...
分类:
其他好文 时间:
2015-05-10 09:50:12
阅读次数:
211
HOJ2276, SOJ2498 ,Count prime,区间素数筛,数论
Given an integer interval [L, R](L <= R <= 2147483647, R - L <= 1000000), please calculate the number of prime(s) in the interval....
分类:
其他好文 时间:
2015-05-10 09:47:50
阅读次数:
179