Light OJ 1234 Harmonic Number Harmonic series section and

Source: Internet
Author: User

Source: Light OJ 1234 Harmonic Number

Question:

Train of Thought: no idea. This is a high number of things. When the divergence n is large enough, It is infinitely infinite and the formula is used to solve the problem.


# Include

 
  
# Include

  
   
# Include

   
    
# Include

    
     
# Include

     
      
Using namespace std; const int maxn = 1000010; const double phi = 0.57721566490153286060651209; double a [maxn]; int main () {for (int I = 1; I <= 1000000; I ++) a [I] = a [I-1] + 1.0/I; int cas = 1; int T; scanf ("% d", & T ); while (T --) {int n; scanf ("% d", & n); double ans; if (n <= 1000000) ans = a [n]; elseans = log (n + 0.5) + phi; printf ("Case % d: %. 10lf \ n ", cas ++, ans);} return 0 ;}

     

    

   

  

 


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.