POJ 1284 Primitive Roots 原根
来源:互联网 发布:linux mint 使用教程 编辑:程序博客网 时间:2024/06/06 11:50
题目来源:POJ 1284 Primitive Roots
题意:求奇素数的原根数
思路:一个数n是奇素数才有原根 原根数是n-1的欧拉函数
#include <cstdio>const int maxn = 70000;int phi[maxn];void phi_table(int n){for(int i = 2; i <= n; i++)phi[i] = 0;phi[1] = 1;for(int i = 2; i <= n; i++)if(!phi[i])for(int j = i; j <= n; j += i) { if(!phi[j]) phi[j] = j; phi[j] = phi[j] / i * (i-1); }}int main(){phi_table(65536);int n;while(scanf("%d", &n) != EOF){printf("%d\n", phi[n-1]);}return 0;}
0 0
- POJ 1284 Primitive Roots(素数原根)
- poj 1284 Primitive Roots 【原根】【数论】
- POJ 1284 Primitive Roots 原根
- POJ 1284 Primitive Roots (原根)
- POJ 1284 Primitive Roots 原根个数
- POJ 1284 Primitive Roots 原根
- POJ 1284 Primitive Roots (原根,欧拉函数)
- POJ 1284 Primitive Roots 原根(欧拉函数)
- POJ 1284 Primitive Roots (欧拉函数&原根定理)
- poj 1284 Primitive Roots(欧拉函数,原根定理)
- poj 1284 Primitive Roots(原根+欧拉函数)
- POJ 1284 : Primitive Roots - 欧拉函数,原根
- [POJ 1284] Primitive Roots (数论,原根)
- POJ-1284 Primitive Roots(原根的个数定理)
- POJ 1284 Primitive Roots
- poj - 1284 - Primitive Roots
- Poj 1284 Primitive Roots
- 【POJ 1284】Primitive Roots
- Unix网络编程 之 基本套接字调用(一)
- 【最小生成树】hdu 1875 prim
- 探cocos2dx对游戏精灵(sprite_nodes)的实现。(源码版本2.2.3)
- 医学图像处理之一:基于标记的分水岭分割算法
- Leetcode【19】:Remove Nth Node From End of List
- POJ 1284 Primitive Roots 原根
- Spring笔记(9)-------Bean作用域
- 我的zigbee学习笔记(1)----如何利用官方的工程文件修改为自己的工程文件
- jquery 操作下拉框
- 黑马程序员-测试
- GPS MTK3339设置
- CPU寻址范围(寻址空间)一系列问题
- 医学图像处理之二:分割算法评估
- 编译器手工开栈