hdu 6217 A BBP Formula 公式题】的更多相关文章

题意 已知公式:$\pi=\sum_{k=0}^{\infty}\left[\frac{1}{16^{k}}\left(\frac{4}{8 k+1}-\frac{2}{8 k+4}-\frac{1}{8 k+5}-\frac{1}{8 k+6}\right)\right]$ 求 $\pi$ 的第 $n$ 项. 分析 WIKI上有:π的BBP位抽取算法 这类公式是用来求解一些无理数常数的公式,特点是不需要求解前n-1位也能去算第n位 将公式乘以 $16^n$ 就能将小数点移动到第 $n$ 位.…
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) 看到这个时间,我懵逼了... 果然,Java就是打表,都不能AC,因为Java的输入是流,需要的时间比C真的长好多.... Problem Description You just need to calculate the sum of the formula: 1^2+3^2+5^2+--+ n ^2. Input In each…
HDU 4041 Eliminate Witches! (模拟题 ACM ICPC 2011 亚洲北京赛区网络赛题目) Eliminate Witches! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 863    Accepted Submission(s): 342 Problem Description Kaname Mado…
题目链接 F(N) Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 4579 Accepted Submission(s): 1610 Problem Description Giving the N, can you tell me the answer of F(N)? Input Each test case contains a si…
题目链接:公式题 (2) 比赛链接:华东交通大学2018年ACM"双基"程序设计竞赛 题目描述 令f(n)=2f(n-1)+3f(n-2)+n,f(1)=1,f(2)=2 令g(n)=g(n-1)+f(n)+n*n,g(1)=2 告诉你n,输出g(n)的结果,结果对1e9+7取模 输入描述: 多组输入,每行一个整数n(1<=n<=1e9),如果输入为0,停止程序. 输出描述: 在一行中输出对应g(n)的值,结果对1e9+7取模. 示例1 输入 1 5 9 456 0 输出…
题目链接: HDU 7217 题意: 题目给你可以计算 \(π\) 的公式: \(\pi = \sum_{k=0}^{\infty}[\frac{1}{16^k}(\frac{4}{8k+1})-(\frac{2}{8k+4})-(\frac{1}{8k+5})-(\frac{1}{8k+6})]\) 告诉你可以求十六进制下的小数点后 \(π\) 的第 \(n\) 位,而不用计算前 \(n-1\) 项. 十六进制表示下,问你 \(π\) 的小数点后的第 \(n\) 位是多少 $ (1 ≤ n ≤…
Cut the Cake Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 300    Accepted Submission(s): 135 Problem Description MMM got a big big big cake, and invited all her M friends to eat the cake toge…
传送门: Bungee Jumping Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1718    Accepted Submission(s): 729 Problem Description Once again, James Bond is fleeing from some evil people who want to se…
题意:给定一个无穷项的分式,它的和等于π,问π的十六进制表示的小数点后第n位是多少 1 ≤ n ≤ 100000 思路:From https://blog.csdn.net/meopass/article/details/78327614 C++double写起来细节真是烦 #include<cstdio> #include<cstring> #include<string> #include<cmath> #include<iostream>…
Fibonacci Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others) Problem Description We know the Fibonacci Sequence F1=1,F2=1,F3=2,F4=3,F5=5, ... Fx = Fx-1+Fx-2 We want to know the Mth number which has K consecutive "0&qu…