POJ 2407 Relatives
Time Limit: 1000MS | Memory Limit: 65536K | |
Total Submissions: 13920 | Accepted: 6965 |
Description
Input
Output
Sample Input
7
12
0
Sample Output
6
4
Source
#include<cstdio>
int euler_phi(int p){
int phi=p;
for(int i=;i*i<=p;i++){
if(!(p%i)){
phi=phi-phi/i;
while(!(p%i))
p/=i;
}
}
if(p>)
phi=phi-phi/p;
return phi;
}
int main(){
int p;
while(scanf("%d",&p),p)
printf("%d\n",euler_phi(p));
return ;
}
裸的欧拉函数
POJ 2407 Relatives的更多相关文章
- POJ 2407 Relatives(欧拉函数)
http://poj.org/problem?id=2407 题意: 给出一个n,求小于等于的n的数中与n互质的数有几个. 思路: 欧拉函数的作用就是用来求这个的. #include<iostr ...
- 数论 - 欧拉函数模板题 --- poj 2407 : Relatives
Relatives Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 11372 Accepted: 5544 Descri ...
- POJ 2407 Relatives(欧拉函数入门题)
Relatives Given n, a positive integer, how many positive integers less than n are relatively prime t ...
- POJ 2407 Relatives 【欧拉函数】
裸欧拉函数. #include<stdio.h> #include<string.h> ; int p[N],pr[N],cnt; void init(){ ;i<N;i ...
- POJ 2407 Relatives(欧拉函数)
题目链接 题意 : 求小于等于n中与n互质的数的个数. 思路 : 看数学的时候有一部分是将欧拉函数的,虽然我没怎么看懂,但是模板我记得了,所以直接套了一下模板. 这里是欧拉函数的简介. #includ ...
- poj 2407 Relatives(简单欧拉函数)
Description Given n, a positive integer, how many positive integers less than n are relatively prime ...
- POJ 2407 Relatives (欧拉函数)
题目链接 Description Given n, a positive integer, how many positive integers less than n are relatively ...
- POJ 2407 Relatives【欧拉函数】
<题目链接> 题目大意: Given n, a positive integer, how many positive integers less than n are relativel ...
- POJ 2407 Relatives 欧拉函数题解
版权声明:本文作者靖心,靖空间地址:http://blog.csdn.net/kenden23/,未经本作者同意不得转载. https://blog.csdn.net/kenden23/article ...
随机推荐
- Linux 可执行文件 ELF结构 及程序载入执行
Linux下ELF文件类型分为以下几种: 1.可重定位文件,比如SimpleSection.o: 2.可运行文件,比如/bin/bash. 3.共享目标文件,比如/lib/libc.so. 在Linu ...
- qt creator中使用qwt插件
前提:我用mingw编译的qwt. 将qwt插件集成到qt designer非常easy.仅仅要把qwt编译的qwt_designer_plugin.dll复制到C:\Qt\Qt5.3.1\5.3\m ...
- 0c-35-自动释放池使用注意
.autorelease使用注意 )并不是放到自动释放池中,都会自动加入到自动释放池 1.1) 因为没有调用autorelease方法,所以对象没有加入到自动释放池. int main(){ @aut ...
- Linux TCP队列相关参数的总结 转
在Linux上做网络应用的性能优化时,一般都会对TCP相关的内核参数进行调节,特别是和缓冲.队列有关的参数.网上搜到的文章会告诉你需要修改哪些参数,但我们经常是知其然而不知其所以然,每次照抄过 ...
- LinkedHashMap介绍
转载:http://uule.iteye.com/blog/1522291 jdk1.7API文档链接:http://tool.oschina.net/apidocs/apidoc?api=jdk_7 ...
- 过滤文本文档中的数据并插入Cassandra数据库
代码如下: package com.locationdataprocess; import java.io.BufferedReader; import java.io.File; import ja ...
- android genymation eclipse安装
http://www.cnblogs.com/1114250779boke/p/3657996.html
- 项目源码--Android迷幻岛屿综合游戏
下载源码 技术要点: 1.游戏开发综合技术 2.多线程机制实现游戏逻辑 3.自定义控件,系统控件等综合图层的使用 4.图层素材动画的综合技术 5.游戏算法的实现 6. OpenGL ES的综合使用 7 ...
- 【Android Studio使用教程6】Execution failed for task ':×××:compileReleaseAidl'
使用Android Studio运行项目时候,经常会报一些错,比如 Execution failed for task ':×××:processReleaseResources' Execution ...
- 【Android Studio使用教程2】Android Studio创建项目
创建项目 首先,先指出Android Studio中的两个概念. Project 和 Module .在Android Studio中, Project 的真实含义是工作空间, Module 为一个具 ...