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;
}
}
}

Use of Function Arctan的更多相关文章

  1. SPOJ ARCTAN (数论) Use of Function Arctan

    详细的题解见这里. 图片转自上面的博客 假设我们已经推导出来x在处取得最小值,并且注意到这个点是位于两个整点之间的,所以从这两个整数往左右两边枚举b就能找到b+c的最小值. 其实只用往一边枚举就够了, ...

  2. Delphi常用系统函数总结

    Delphi常用系统函数总结 字符串处理函数 Unit System 函数原型 function Concat(s1 [, s2,..., sn]: string): string; 说明 与 S : ...

  3. 通过百度echarts实现数据图表展示功能

    现在我们在工作中,在开发中都会或多或少的用到图表统计数据显示给用户.通过图表可以很直观的,直接的将数据呈现出来.这里我就介绍说一下利用百度开源的echarts图表技术实现的具体功能. 1.对于不太理解 ...

  4. 一个包含arctan与arctanh的积分

    \[\Large\int_0^1\frac{\arctan x \,\operatorname{arctanh} x\, \ln x}{x}\mathrm{d}x=\frac{\pi^2}{16}\m ...

  5. jsp中出现onclick函数提示Cannot return from outside a function or method

    在使用Myeclipse10部署完项目后,原先不出错的项目,会有红色的叉叉,JSP页面会提示onclick函数错误 Cannot return from outside a function or m ...

  6. JavaScript function函数种类

    本篇主要介绍普通函数.匿名函数.闭包函数 目录 1. 普通函数:介绍普通函数的特性:同名覆盖.arguments对象.默认返回值等. 2. 匿名函数:介绍匿名函数的特性:变量匿名函数.无名称匿名函数. ...

  7. 在ubuntu16.10 PHP测试连接MySQL中出现Call to undefined function: mysql_connect()

    1.问题: 测试php7.0 链接mysql数据库的时候发生错误: Fatal error: Uncaught Error: Call to undefined function mysqli_con ...

  8. jquery中的$(document).ready(function() {});

    当文档载入时执行function函数里的代码, 这部分代码主要声明,页面加载后 "监听事件" 的方法.例如: $(document).ready( $("a") ...

  9. Function.prototype.toString 的使用技巧

    Function.prototype.toString这个原型方法可以帮助你获得函数的源代码, 比如: function hello ( msg ){ console.log("hello& ...

随机推荐

  1. java统计文档中相同字符出现次数(超详细)

    public class test { public static void main(String[] args) throws Exception { InputStream file = new ...

  2. @清晰掉 sprintf sscanf双胞胎

    sprintf() 格式化输出函数(图形) 功能: 函数sprintf()用来作格式化的输出.用法: 此函数调用方式为int sprintf(char *string,char *format,arg ...

  3. kafka-manager怎么查看topic里的数据量

    https://jingyan.baidu.com/article/eb9f7b6d367679869364e8d4.html

  4. MySql 使用递归函数时遇到的级联删除问题

    以下两段SQL的写法看似相同,结果效果却是不同的 写法A: DELETE OM_ORGANIZATION, OM_POSITION FROM OM_ORGANIZATION LEFT JOIN OM_ ...

  5. 通过同步上下文方式更新winform中的控件信息

    SynchronizationContext 类是一个基类,可提供不带同步的自由线程上下文. 此类实现的同步模型的目的是使公共语言运行库内部的异步/同步操作能够针对不同的异步模型采取正确的行为.此模型 ...

  6. PushConsumer 消费消息

    CLUSTERING 模式下,消费者会订阅 retry topic // DefaultMQPushConsumerImpl#copySubscription private void copySub ...

  7. C# 程序异常停止后,sqlite可能变成0kb……

    解决办法就是即时备份数据库文件,启动时判断数据库文件是否为0kb,是则还原之

  8. MySQL5.6版本之后设置DATETIME类型自动更新

    在使用MySQL中datetime格式自动更新特性时,我们应该明确一点,datetime格式设置默认值为当前时间和自动更新时间是从MySQL5.6版本之后开始支持的.此前我们都是使用timestamp ...

  9. 【EWM系列】SAP EWM中仓库任务WT创建的函数

    公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[EWM系列]SAP EWM中仓库任务WT创建的 ...

  10. IP子网的划分

    一.划分子网的具体步骤 已知192.168.1.0/24,划分8个子网(一个ip划分8个子网,即网络位不再是24位)1100 0000.1010 1000.0000 0001.0000 00001 . ...