• Use of Function Arctan


     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 
     4 
     5 
     6 
     7 
     8 #include<stdio.h>
     9 typedef long long LL;
    10 int main()
    11 {
    12     LL B,C,A,i,j,T;
    13     scanf("%lld",&T);    
    14     for(i=1;i<=T;i++)
    15     {
    16         scanf("%lld",&A);
    17         LL tmp=2*A+2;
    18         while((tmp--)>A)
    19         if((A*tmp+1)%(tmp-A)==0)
    20         {
    21             B=(A*tmp+1)/(tmp-A);
    22             printf("%lld
    ",tmp+B);
    23             break;
    24         }    
    25     }
    26 }
    View Code
  • 相关阅读:
    小数的进制转换
    水题 O
    水题 J
    水题T,二进制转16进制
    水题B
    水题C
    HDU 2042
    HDU 2041
    Index For SQL Server
    Learning Note For Angular
  • 原文地址:https://www.cnblogs.com/skykill/p/3231281.html
Copyright © 2020-2023  润新知