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

  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--枚举即可!!!))*/
  2.  
  3. #include<stdio.h>
  4. typedef long long LL;
  5. int main()
  6. {
  7. LL B,C,A,i,j,T;
  8. scanf("%lld",&T);
  9. for(i=;i<=T;i++)
  10. {
  11. scanf("%lld",&A);
  12. LL tmp=*A+;
  13. while((tmp--)>A)
  14. if((A*tmp+)%(tmp-A)==)
  15. {
  16. B=(A*tmp+)/(tmp-A);
  17. printf("%lld\n",tmp+B);
  18. break;
  19. }
  20. }
  21. }

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. 第五周总结 & 实验报告(三)

    第五周总结 一.继承       1.类的继承格式 class 父类{} class 子类 extends 父类{} 2.扩展类的功能 class 父类{ 父类属性: .......... ..... ...

  2. 【机器学习速成宝典】模型篇03逻辑斯谛回归【Logistic回归】(Python版)

    目录 一元线性回归.多元线性回归.Logistic回归.广义线性回归.非线性回归的关系 什么是极大似然估计 逻辑斯谛回归(Logistic回归) 多类分类Logistic回归 Python代码(skl ...

  3. Qt数据库之数据库连接池

     前面的章节里,我们使用了下面的函数创建和取得数据库连接: void createConnectionByName(const QString &connectionName) { QSql ...

  4. http://www.malware-traffic-analysis.net/2018/index.html

    http://www.malware-traffic-analysis.net/2018/index.html

  5. mappers:将sql映射注册到全局配置中

    <!-- 将我们写好的sql映射文件(EmployeeMapper.xml)一定要注册到全局配置文件(mybatis-config.xml)中 --> <!-- 6.mappers: ...

  6. linux fedora原生的快捷键操作

    显示桌面: ctrl+alt+d 运行终端程序: gnome-terminal : 可以自定义快捷键: ctrl+T 等等.

  7. 1、maven的下载,安装,配置

    下载 1.maven官方下载地址: http://maven.apache.org/download.cgi 进入官网: 下载各历史版本官方地址: https://archive.apache.org ...

  8. 前端必须掌握的 docker 技能(3)

    概述 作为一个前端,我觉得必须要学会使用 docker 干下面几件事: 部署前端应用 部署 nginx 给部署的 nginx 加上 https 使用 docker compose 进行部署 给 ngi ...

  9. ffmpeg mp4 to wmv and wmv to mp4

    //大小=>变小ffmpeg -i 1.mp4 -b:v 2M -vcodec msmpeg4 -acodec wmav2 1_mp4.wmv//大小=>变大ffmpeg -i 1.mp4 ...

  10. 阶段3 1.Mybatis_12.Mybatis注解开发_2 mybatis注解开发测试和使用注意事项

    新建测试类 这里使用了main方法进行测试 InputStream需要抛出异常 写完进行测试 测试结果 讲解 把第一天的IUserDao.xml文件复制到当前的工程里面 红色的取值要用的.黄色的是执行 ...