hdu 5430 reflect (欧拉函数)
来源:互联网 发布:人工智能的龙头股票 编辑:程序博客网 时间:2024/05/18 02:24
从一个圆上一点发射光线,问反射N次后恰好第一次回到起点的发射方案数。
主要说一下为什么K/(N+1)需要是一个既约分数。
设g=gcd(K,N+1),k=K/g,n=(N+1)/g,即有g*(2*θ*n)=g*(2*k*Pi),即相当于反射n-1次回到起点g次。这样,如果g!=1,是不符合题意的。
关于欧拉函数
#include <iostream>using namespace std;#define Max 1000002int euler[Max];void Init(){ euler[1]=1; for(int i=2;i<Max;i++) euler[i]=i; for(int i=2;i<Max;i++) if(euler[i]==i) for(int j=i;j<Max;j+=i) euler[j]=euler[j]/i*(i-1);}int main(){ int t,n; Init(); cin>>t; while(t--) { cin>>n; cout<<euler[n+1]<<endl; } return 0 ;}
0 0
- hdu 5430 reflect (欧拉函数)
- hdu 5430 Reflect(欧拉函数)
- hdu 5430 Reflect(欧拉函数)
- HDU 5430:Reflect 欧拉函数
- HDU 5430 Reflect 欧拉函数
- HDU 5430-Reflect(欧拉函数求圆内反射方法数)
- HDU 5430 Reflect (欧拉函数) (类似UVA 12493 Stars)
- hdu 5430 Reflect 求圆镜内反射N次回到出口的方法数 欧拉函数
- BC - Reflect(欧拉函数)
- HDU 5430 Reflect
- HDU 5430 Reflect
- hdu 5430 Reflect(数论)
- hdu-1286欧拉函数
- hdu 2588 欧拉函数
- hdu 2824 欧拉函数
- hdu 1787 欧拉函数
- 欧拉函数 hdu 2824
- hdu~3501~欧拉函数
- OpenGL-----Tone Mapping
- 黑马程序员—Java集合框架
- hdu 5429 Geometric Progression (等比数列判定+大数模板)
- Inotify Example: Introduction to Inotify with a C Program Example
- hdu 5428 the factor(分解质因子)
- hdu 5430 reflect (欧拉函数)
- NSOperation综合案例: 下载图片/技术选择
- iCloud和Core Data
- Leetcode: Ugly Number II
- SDWebImage
- C++支持的程序设计范式
- SDWebImage常识
- 自定义 NSOperation
- 2014 ACM/ICPC Asia Regional Xi'an Online