Use of Function Arctan

Time Limit:10000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Submit   Status Description It's easy to know that arctan(1/2)+arctan(1/3)=arctan(1).The problem is,to some fixed number A,you have to write a program to calculate the minimum sum B+C.A,B and C are all positive integers and satisfy the equation below:

arctan(1/A)=arctan(1/B)+arctan(1/C)

Input The first line conta

ins a integer number T.T lines follow,each contains a single integer A, 1<=A<=60000.

Output T lines,each contains a single integer whic

h denotes to the minimum sum B+C.

Sample Input 1 1

 /*由题意知:B(C-A)=1+AC;B=(1+AC)/(C-A);B=A+(1+AA)/(C-A);C增B减;(易知B=C时B+C最小(此时B=C=a可能为小数,故只需B--枚举即可!!!))*/

 #include<stdio.h>
typedef long long LL;
int main()
{
LL B,C,A,i,j,T;
scanf("%lld",&T);
for(i=;i<=T;i++)
{
scanf("%lld",&A);
LL tmp=*A+;
while((tmp--)>A)
if((A*tmp+)%(tmp-A)==)
{
B=(A*tmp+)/(tmp-A);
printf("%lld\n",tmp+B);
break;
}
}
}

最新文章

  1. 论Pair的重要性
  2. 简单回顾NPOI导入导出excel文件
  3. 使用async 和 await方法来
  4. Git标签和别名管理
  5. poj3249Test for Job(记忆化搜索)
  6. Python之路 day2 字符串函数
  7. jQuery轮播
  8. django 1.7 新特性 --- data migration
  9. SQL阻止保存要求重新创建表的更改 在哪里设置
  10. event事件:
  11. Eclipse创建Maven Web项目 + 测试覆盖率 + 常见问题(2015.07.14——湛耀)
  12. ubuntu 12.04 mysql转移目录后 无法 启动
  13. 从Java视角理解CPU缓存(CPU Cache)
  14. 优化从 App.config 读取配置文件
  15. ROS(indigo)机器人操作系统学习有趣丰富的Gazebo仿真示例evarobot
  16. CF1114D 【Flood Fill】
  17. javascript基础 之 void
  18. sourceTree如何不用注册就使用
  19. hive on tez配置
  20. .NET 常用ORM之Nbear

热门文章

  1. MVC Areas的使用
  2. 将Microsoft SQL Server 2000数据库转换成MySQL数据库
  3. 一、基础篇--1.1Java基础-包装类的装箱和拆箱
  4. hdu 4758 (AC自动机)
  5. 设计模式(2): 响应store中数据的变化
  6. Unity3D 协程 Coroutine
  7. JMV监控工具之JConsole
  8. RabbitMQ使用(下)
  9. TCP/IP协议-1
  10. [转帖]OEM、ODM、OBM分别是什么?