题目大意:给你一个奇数N,求1~N中奇数的平方和。
思路:直接暴力超时了,所以用公式来做 S = N*(N+1)*(N+2)/6,因为结果不超int型,
但是中间过程会超一些,所以用__int64来做就可以了。注意cin、cout会超时,用scanf
和printf就可以了。...
分类:
其他好文 时间:
2015-01-29 22:36:22
阅读次数:
247
题目大意:求出我们可以通过求∑(1#include #include using namespace std;#define ll long longconst int N = 4000010;int prime[N] , phi[N] , tot;bool vis[N];void get_phi(...
分类:
其他好文 时间:
2015-01-29 22:20:47
阅读次数:
132
题目大意:计算1~N的立方和
思路:1~N的立方和公式为S(N) = 1^3 + 2^3 + 3^3 + … + N^3 = N^2*(N+1)^2/4。
然后题目要求后四位,取余即可。...
分类:
其他好文 时间:
2015-01-28 21:25:48
阅读次数:
206
Problem Description
Given an integer N(0 ≤ N ≤ 10000), your task is to calculate N!
Input
One N in one line, process to the end of file.
Output
For each N, output N! in one line.
...
分类:
其他好文 时间:
2015-01-26 22:54:23
阅读次数:
236
10001st prime
Problem 7
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
What is the 10 001st prime number?
python code :
import ma...
分类:
编程语言 时间:
2015-01-26 22:47:11
阅读次数:
208
Problem 3
The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 600851475143 ?
python code:
import math
sqrt=math.sqrt
def func(x):
...
分类:
编程语言 时间:
2015-01-26 21:07:23
阅读次数:
216
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4135题目解析:给你一个闭区间[A,B](1 #include #include #include #include using namespace std;typedef __int64 ll;ll x...
分类:
其他好文 时间:
2015-01-25 15:06:37
阅读次数:
137
题意:For each three prime numbers p1, p2 and p3, let's define Hamming sequence Hi(p1, p2, p3), i=1, ... as containing in increasing order all the natura...
分类:
其他好文 时间:
2015-01-24 23:59:24
阅读次数:
305
同事用MyEclipse6.5不知道为什么就是用不了maven,导入weblogic.jar也不会自动引入相关的jar,于是升级到2014以后,以为导入maven项目应该没问题了,谁知报错:
Errors occurred during the build.
Errors running builder 'Maven Project Builder' on project 'acctmanm'.
Could not calculate build plan: Plugin org.apache.maven....
分类:
编程语言 时间:
2015-01-24 17:24:20
阅读次数:
438
题目地址:POJ 3292
先利用素数筛的原理把H_prime筛出来,然后打表。要预处理,否则TLE。
代码如下:
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
#define LL __int64
#define p...
分类:
其他好文 时间:
2015-01-23 11:17:37
阅读次数:
195