n最大为2000000000(不知为什么OJ上是1000),若为判断2000000000是素数,则必有一个素数在sqrt(n)内,求出这个范围 的所有素数,其比最大数据小的n'的sqrt(n')也在这个范围 内。#include #include #include #include #include...
转载 2014-08-27 20:47:00
48阅读
2评论
可以用素数定理来解决。素数定理:小于n的素数个数记为p(n),则随着n的增长,p(n)/(n/ln(n))=1。#include #include #include #include using namespace std;int main(){ double n; while(scanf("%lf...
转载 2014-08-27 19:25:00
59阅读
2评论
其实一道公式题:n!中素数i的幂为:[n/i]+[n/i^2]+[n/i^3]+[n/i^4]+......#include #include #include using namespace std;long long n;int main(){ long long two,five; int t...
转载 2014-08-28 09:19:00
40阅读
2评论
和上一题一样,注意除不尽为0#include #include #include #include using namespace std;long long n,p;int main(){ int t; scanf("%d",&t); while(t--){ scanf("%lld%lld",&...
转载 2014-08-28 09:46:00
48阅读
2评论
其实就是筛选素数。如,若能被2是质数,则2的倍数全是合数。如此循环。#include #include #include #include #include using namespace std;const int Max=(1<<24);bool prime[Max+10];bool judge...
转载 2014-08-27 19:56:00
82阅读
2评论
其实同POJ 1061#include #include #include #include using namespace std;long long gcd(long long a,long long b){ if(b==0) return a; return gcd(b,a%b);}void...
转载 2014-08-27 15:17:00
68阅读
2评论
刚开始,做了水题#include #include #include using namespace std;int main(){ int n; int a31,a32,a41,a42,a121,a122,ans3,ans4,ans12; while(scanf("%d",&n)!=EOF){ ...
转载 2014-08-27 09:38:00
52阅读
2评论
#include<iostream>using namespace std;int max(int data1,int data2){ return data1>data2?data1:data2;} int N; int data[101][101]; int Data[101][101];    int main(){     while(cin>>N) {  f
转载 2012-11-20 20:05:00
63阅读
2评论
最简单的递推不解释!!!呵呵!! #include<iostream>#include<algorithm>using namespace std;int n,f[20][20];int CrossRoad(int L,int W){   if(f[L][W]!=-1)    return f[L][W]; int result; if(L==0||W==0)     re
转载 2012-11-15 21:00:00
32阅读
2评论
TripTime Limit 1000msMemory Limit 65536Kdescription Xiao wang has a new car, so he wants to have a trip from his home to hefei, however, there is no road from his house directly to Hefei, so he has to go through a number of cities to get to hefei, his car takes one unit of time driving a unit dista.
转载 2013-04-20 19:25:00
30阅读
2评论
nefu 462 fib组合 (斐波那契数列的通项公式以及推倒过程)分类:数学2014-05-21 10:27190人阅读评论(0)收藏举报题目链接:http://acm.nefu.edu.cn/JudgeOnline/problemshow.php?problem_id=462斐波那契数列的通项公...
转载 2015-10-12 20:14:00
108阅读
2评论
GridsTime Limit 1000msMemory Limit 65536KdescriptionOn an 1 × 1 grid,partition the length and width into 50 parts,forming 2500 unit grids with the same size.Now,given n circles with equal radius R on the grid.Find the total number of unit grids which are not covered by any of a circle. A unit g
转载 2013-04-20 19:10:00
33阅读
2评论
Time Limit 1000ms Memory Limit 65536K description On an 1 × 1 grid,partition the length and width into 50 parts,forming 2500 unit grids with
原创 2023-02-24 10:18:08
42阅读
[Linux]实验二蹭一下大数据的实验平台,感谢yjj贡献帐号以真实姓名的拼音缩写为用户名,创
原创 2022-11-25 19:39:38
121阅读
水#include #include #include using namespace std;long long gcd(long long a,long long b){ if(b==0) return a; return gcd(b,a%b);}int main(){ long long a,...
转载 2014-08-27 09:55:00
61阅读
2评论
Trip Time Limit 1000ms Memory Limit 65536K description   Xiao wang has a new car, so he wants to have a trip from his home to hefei, however, ther
原创 2023-02-24 10:17:59
35阅读
Magic TreeTime Limit 1000msMemory Limit 65536Kdescription Every acmer dream for gold medal. Fotunately,there are two magic trees (which are conveniently numbered 1 and 2) in our campus, each full of gold medal. The trees are very high, so we can not touch the gold medal when they are in the tree bu.
转载 2013-04-20 19:20:00
56阅读
2评论
HELPTime Limit 1000msMemory Limit 65536Kdescription You are a warrior, but your dear princess was caught by big devil. you want to save the princess. each round, you can go around (up ,down ,left, right) ,if the place you stand is a slime or snake you will dead, if the place you stand is a boat o...
转载 2013-04-29 21:08:00
59阅读
2评论
三国之战 Time Limit 1000 Memory Limit 65536 description 在三国某某战争中,魏军要围攻蜀国. ,诸葛亮亲自指挥战争,对抗曹操。现假设诸葛亮有N个大炮,每个大炮都有一个攻击值ai(ai>=0 &&ai=0 && x#include#include#include#define N
转载 2012-08-08 15:12:00
140阅读
2评论
始依次产生半数集set(n).set(n)的定义如下:(1) n是set(n)中的元素(2)
原创 2023-04-21 06:18:27
32阅读
  • 1
  • 2
  • 3
  • 4
  • 5