![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
离线处理
Jeromiewn
不可以!
展开
-
hdu 2824 The Euler function (欧拉函数离线模板)
欧拉函数离线处理模板 根据欧拉公式递推公式写函数: 令a是n的最小质因数, if(n%a==0&&(n/a)%a==0)euler(n)=euler(n/a)*a; if(n%a==0&&(n/a)%a!=0) euler(n)=euler(n/a)*(a-1) 纯模板,统计和sum,暴力打表 int phi[N]; int prime[N],isprime[N]; vo原创 2016-10-24 22:55:36 · 391 阅读 · 0 评论 -
高精度大整数模板(n!为例)
如求n! 1.打表(就是个想法,显然会超内存,数据范围1000可以) #include #include using namespace std; const int N=100000; const int M=10001; int a[M][7200]; void fun() { a[1][1]=1; a[2][1]=2; for(int i=3;i<M;i++)原创 2016-10-30 20:28:03 · 624 阅读 · 0 评论 -
hdu 1041 Computer Transformation(递推+大整数模板*)
多列几个,找到递推公式 1,0 2,1 3,1 4,3 5,5 6,11 7,21 找了规律可以得到递推公式 f(n)=f(n-1)+2*f(n-2)很像斐波那契 但由于n的范围是1000 所以每次结果都储存一下 所以目测结果需要用大数来做,用数组储存大数,一个储存四位的模板: #include #include #include using namespace原创 2016-10-30 19:25:01 · 431 阅读 · 0 评论 -
hdu 1250 (大整数模板+打表)
大整数,二维数组打表 同hdu 1041题类似,直接改了模板 直接求会超内存 #include #include #include using namespace std; const int mod=100000; int a[7500][410]; void fun()//打表 { a[1][1]=1; a[2][1]=1; a[3][1]=1; a[4原创 2016-10-30 21:31:50 · 424 阅读 · 0 评论 -
hdu 1016(dfs基础)
题意:输入一个数n,把1到n的自然数放到一个环里,保证相邻的两个数的和是素数。(1和n 思路:素数打表+深搜 #include #include #include #include using namespace std; int a[25],b[45]= {0},n; int isprime[40]= {0,1,1,1,0,1,0,1,0,0,0,1,0,1,0,0,0,原创 2016-11-12 20:15:40 · 443 阅读 · 0 评论