hdu 2824 The Euler function 欧拉函数打表
The Euler function
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
#include<iostream>
#include<cstdio>
#include<cmath>
#include<string>
#include<queue>
#include<algorithm>
#include<stack>
#include<cstring>
#include<vector>
#include<list>
#include<set>
#include<map>
using namespace std;
#define ll __int64
#define mod 1000000007
#define inf 999999999
//#pragma comment(linker, "/STACK:102400000,102400000")
int scan()
{
int res = , ch ;
while( !( ( ch = getchar() ) >= '' && ch <= '' ) )
{
if( ch == EOF ) return << ;
}
res = ch - '' ;
while( ( ch = getchar() ) >= '' && ch <= '' )
res = res * + ( ch - '' ) ;
return res ;
}
int p[],N=;
void phi()
{
for(int i=; i<N; i++) p[i] = i;
for(int i=; i<N; i+=) p[i] >>= ;
for(int i=; i<N; i+=)
{
if(p[i] == i)
{
for(int j=i; j<N; j+=i)
p[j] = p[j] - p[j] / i;
}
}
}
int main()
{
int x,y,z,i,t;
phi();
while(~scanf("%d%d",&x,&y))
{
ll ans=;
for(i=x;i<=y;i++)
ans+=p[i];
printf("%I64d\n",ans);
}
return ;
}
hdu 2824 The Euler function 欧拉函数打表的更多相关文章
- hdu 2824 The Euler function(欧拉函数)
题目链接:hdu 2824 The Euler function 题意: 让你求一段区间的欧拉函数值. 题解: 直接上板子. 推导过程: 定义:对于正整数n,φ(n)是小于或等于n的正整数中,与n互质 ...
- HDU - 2824 The Euler function 欧拉函数筛 模板
HDU - 2824 题意: 求[a,b]间的欧拉函数和.这道题卡内存,只能开一个数组. 思路: ϕ(n) = n * (p-1)/p * ... 可利用线性筛法求出所有ϕ(n) . #include ...
- HDU 6322.Problem D. Euler Function -欧拉函数水题(假的数论题 ̄▽ ̄) (2018 Multi-University Training Contest 3 1004)
6322.Problem D. Euler Function 题意就是找欧拉函数为合数的第n个数是什么. 欧拉函数从1到50打个表,发现规律,然后勇敢的水一下就过了. 官方题解: 代码: //1004 ...
- (hdu step 7.2.1)The Euler function(欧拉函数模板题——求phi[a]到phi[b]的和)
题目: The Euler function Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Othe ...
- HDU 2824 The Euler function --------欧拉模板
The Euler function Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Other ...
- HDU 5597 GTW likes function 欧拉函数
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5597 题意: http://bestcoder.hdu.edu.cn/contests/contes ...
- UVA 11426 GCD - Extreme (II)(欧拉函数打表 + 规律)
Given the value of N, you will have to find the value of G. The definition of G is given below:Here ...
- A - Bi-shoe and Phi-shoe (欧拉函数打表)
Description Bamboo Pole-vault is a massively popular sport in Xzhiland. And Master Phi-shoe is a ver ...
- POJ 2478 欧拉函数打表的运用
http://poj.org/problem?id=2478 此题只是用简单的欧拉函数求每一个数的互质数的值会超时,因为要求很多数据的欧拉函数值,所以选用欧拉函数打表法. PS:因为最后得到的结果会很 ...
随机推荐
- POJ1860:Currency Exchange(BF)
http://poj.org/problem?id=1860 Description Several currency exchange points are working in our city. ...
- python接口自动化-参数化
原文地址https://www.cnblogs.com/yoyoketang/p/6891710.html python接口自动化 -参数关联(一)https://www.cnblogs.com/11 ...
- HTTP 头和 PHP header() 函数
http://unifreak.github.io/translation/Http_headers_and_PHP_header()_function 引言 许多初级到中级的的 PHP 程序员把 h ...
- discuz模板引擎
discuz是采用“编译型的模板”,就是指采用普通网页文件保存,在文件中插入需要动态显示数据的仿php的代码,最后进行编译成真正的php的文件保存为模板缓存文件,这个转换的过程就称为编译.在用户浏览页 ...
- tfs项目解绑及svn上传
1.tfs解绑 file--源代码管理——tfs解绑 2.svn将本地的文件夹上传到server 右击--import--url--新建文件夹
- 新版.Net开发必备十大工具(转)
Snippet Compiler Snippet Compiler是一个基于 Windows 的小型应用程序,你可以通过它来编写.编译和运行代码.如果你具有较小的代码段,并且你不想创建完整的 Visu ...
- linux常用命令:ip 命令
ip命令是Linux下较新的功能强大的网络配置工具. 1.命令格式: ip [OPTIONS] OBJECT [COMMAND [ARGUMENTS]] 2.命令功能: ip命令用来显示或操纵L ...
- linux常用命令:chkconfig 命令
chkconfig命令用来安装,查看或修改 services随系统启动的启动选项的设置.是Red Hat公司遵循GPL规则所开发的程序,它可查询操作系统在每一个执行等级中会执行哪些系统服务,其中包括各 ...
- emoj表情过滤
用法: isEmojiCharacter(input_value) // 提交时候校验.true:emoj表情 undefined:无 if(isEmojiCharacter(val) ...
- 电脑异常断电,IDEA崩溃
今天电脑突然断电,当时正好开着idea,等了半天无果,只能强行关机重启.重启之后,那么问题来了:重新打开idea报错java.lang.AssertionError:upexpected conten ...