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