HDU1286---找新朋友 HDU(104)
来源:互联网 发布:加密内容以便保护数据 编辑:程序博客网 时间:2024/05/22 23:59
#pragma warning(disable:4786)#include<iostream>#include<algorithm>#include<cmath>#include<stdio.h>#include<time.h>#include<stdlib.h>#include<queue>#include<set>#include<vector>#include<string>#include<ctime>#include<string.h>using namespace std;#define pi acos(-1.0)//#define LL __int64typedef long long LL;#define INF 0x7fffffffffffffff#define bug puts("hear!")#define inf 0x7fffffff#define eps 1e-10#define FRE freopen("in.txt","r",stdin)#define E exp(1.0)#define mod 1000000007int l;void Eu(int n){ for(int i = 2; i * i <= n;++i){ if(!(n%i)){ l *= i - 1; n /= i; while(!(n%i)){ l *= i;n/=i; } } } if(n > 1){ l *= n -1; } return ;}int main(){ int n; scanf("%d",&n); while(n--) { int a; scanf("%d",&a); l=1; Eu(a); printf("%d\n",l); } return 0;}
本来想直接欧几里得算法求个数的,但是TLE了。上网查了查,还真是一个欧拉函数解决了。
但是机器容易TLE,所以就直接用O(log2n)的方法了。
- HDU1286---找新朋友 HDU(104)
- HDU1286:找新朋友
- hdu1286 找新朋友
- hdu1286-找新朋友
- hdu1286-找新朋友
- HDU1286 找新朋友
- hdu1286 找新朋友
- hdu1286找新朋友
- HDU1286:找新朋友
- 找新朋友||HDU1286
- HDU1286找新朋友(求欧拉函数)
- 【HDU1286】找新朋友(欧拉)
- hdu1286 找新朋友 (欧拉函数法)
- 欧拉函数(hdu1286找新朋友)
- 找新朋友(hdu1286,欧拉函数)
- hdu1286 找新朋友 (同因子个数)
- 欧拉函数(例:HDU1286 找新朋友)
- HDU1286 找新朋友(欧拉函数)
- DiskGeniux无损分区
- C语言学习之位操作
- 拔掉那颗蛀牙的红警
- 山东省赛A题:Rescue The Princess
- 单链表的基本操作
- HDU1286---找新朋友 HDU(104)
- mp4文件格式解析
- hdu1754 I Hate It
- PHP自学之路---报表及绘图技术
- 解决 gento 终端中文方块
- Jfinal+quartz实现作业调度
- Windows xp 无法远程连接Windows Server 2008
- 【python】ascii codec can't decode byte 0xe8 in position 0:ordinal not in range(128)
- Python笔记