博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
hdu 5430 Reflect (数学推导题)
阅读量:7061 次
发布时间:2019-06-28

本文共 1283 字,大约阅读时间需要 4 分钟。

Problem Description

We send a light from one point on a mirror material circle,it reflects N times and return the original point firstly.Your task is calcuate the number of schemes.![](../../data/images/C628-1004-1.jpg)

 

 
Input
First line contains a single integer T(T≤10) which denotes the number of test cases. For each test case, there is an positive integer N(N≤106).

 

 
Output
For each case, output the answer.

 

 
Sample Input
1 4

 

 
Sample Output
4

 

 
Source
 
 
对应中文题目
问题描述
从镜面材质的圆上一点发出一道光线反射NNN次后首次回到起点。 问本质不同的发射的方案数。
输入描述
第一行一个整数T,表示数据组数。T≤10T \leq 10T≤10 对于每一个组,共一行,包含一个整数,表示正整数N(1≤N≤106)N(1 \leq N \leq 10^{6})N(1≤N≤106)。
输出描述
对于每一个组,输出共一行,包含一个整数,表示答案。
输入样例
14
输出样例
4 来自官方题解
 
 
1 #include
2 #include
3 #include
4 #include
5 #include
6 #include
7 using namespace std; 8 #define ll long long 9 ll n;10 ll eular(ll n)11 {12 ll res=1;13 for(ll i=2;i*i<=n;i++)14 {15 if(n%i==0)16 {17 n/=i,res*=i-1;18 while(n%i==0)19 {20 n/=i;21 res*=i;22 }23 }24 }25 if(n>1) res*=n-1;26 return res;27 }28 int main()29 {30 int t;31 scanf("%d",&t);32 while(t--){33 scanf("%I64d",&n);34 ll ans=eular(n+1);35 printf("%I64d\n",ans);36 }37 return 0;38 }
View Code

 

转载地址:http://nsyll.baihongyu.com/

你可能感兴趣的文章
WCF学习之旅----正式篇之基础框架
查看>>
最近研究如何加速UI界面开发,有点感觉了
查看>>
Linux+Xshell+Xftp+tomcat+jdk部署javaWeb项目
查看>>
c++ 设计模式 之 装饰模式
查看>>
jquery实现广告伸缩效果
查看>>
ArrayBlockingQueue
查看>>
ng-options和ng-checked在表单中的高级运用
查看>>
String
查看>>
同时被两种海水经过的点的坐标 Pacific Atlantic Water Flow
查看>>
intellij idea 编译发布时不拷贝资源文件问题解决方案
查看>>
java开源工作流引擎Jflow Pop返回值设置
查看>>
curl基本用法,curl和wget区别
查看>>
Spark-Streaming 官方文档
查看>>
HTML5编程之旅 第2站 Communication
查看>>
Install the AWS CLI Using the Bundled Installer (Linux, macOS, or Unix)
查看>>
介绍Python中6个序列的内置类型
查看>>
ECMAScript 6 let 命令介绍
查看>>
ZooKeeper - 部署安装
查看>>
Dockerfile RUN, CMD & ENTRYPOINT
查看>>
进程死锁的四个必要条件以及处理策略
查看>>