HDOJ pi 2179
来源:互联网 发布:sql数据修复工具 编辑:程序博客网 时间:2024/06/05 14:07
pi
Time Limit: 6000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 646 Accepted Submission(s): 336
Problem Description
计算圆周率到小数点后5n 位。(本题不可打表)
Input
正整数n<300. n=0结束.
Output
圆周率pi到小数点后5n位.第1行输出3.以5个数为1段.每行最多10段,每段占6列,右对齐.参看Sample
Sample Input
20150
Sample Output
3. 14159 26535 89793 23846 26433 83279 50288 41971 69399 37510 58209 74944 59230 78164 06286 20899 86280 34825 34211 706793. 14159 26535 89793 23846 26433 83279 50288 41971 69399 37510 58209 74944 59230 78164 06286
Author
Zhousc
Source
ECJTU 2008 Summer Contest
Recommend
lcy | We have carefully selected several similar problems for you: 2180 2176 2177 2181 2182
pe半天。用公式算真心不会。。还是打表。。
pe半天。用公式算真心不会。。还是打表。。
#include <iostream>#include <stdio.h>#include <string.h>#include <algorithm>using namespace std;char a[3000]=".1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632788659361533818279682303019520353018529689957736225994138912497217752834791315155748572424541506959508295331168617278558890750983817546374649393192550604009277016711390098488240128583616035637076601047101819429555961989467678374494482553797747268471040475346462080466842590694912933136770289891521047521620569660240580381501935112533824300355876402474964732639141992726042699227967823547816360093417216412199245863150302861829745557067498385054945885869269956909272107975093029553211653449872027559602364806654991198818347977535663698074265425278625518184175746728909777727938000816470600161452491921732172147723501414419735685481613611573525521334757418494684385233239073941433345477624168625189835694855620992192221842725502542568876717904946016534668049886272327917860857843838279679766814541009538837863609506800642251252051173929848960841284886269456042419652850222106611863067442786220391949450471237137869609563643719172874677646575739624138908658326459958133904780275901";void ints(int n){printf("3.\n");for(int i=1;i<=n;){//if((i-1)%50==0)printf(" ");for(int j=0;j<5;j++)printf("%c",a[i++]);if((i-1)%50==0&&(i-1)!=n)printf("\n");/*if((i-1)%50==0)printf(" ");printf("%c",a[i]);if((i%50==0)&&(i!=n))printf("\n");else if((i%5==0)&&(i!=n))printf(" ");*/}}int main(){int n;while(scanf("%d",&n),n){ ints(5*n); printf("\n");} return 0;}
0 0
- HDOJ pi 2179
- PI
- pi
- Pi
- PI
- pi
- Pi
- Pi
- [pi
- pi
- PI
- hdu 2179 pi 母函数
- π (PI)
- pi演算
- PI system
- 蒙特卡洛法求Pi
- 圆周率PI
- 求PI
- 构造函数的相关知识
- Android 实现按两次返回键退出程序
- <Head First 设计模式>:复合模式:duck
- 接口
- cf437C 贪心算法
- HDOJ pi 2179
- .Net网络编程——服务端获取客户端连接
- [CentOS]CentOS7安裝SSH教學
- Android 获取本地外网IP、内网IP、计算机名等信息
- BZOJ 1862: [Zjoi2006]GameZ游戏排名系统 Splay
- FILE
- HDU 1403 Longest Common Substring
- 树莓派 - 架设花生壳
- hadoop环境配置2--jdk配置