这题绝对有毒

题目传送门
题面:根据arctanx(x)=x-x^3/3+x^5/5…,π=6*arctanx(1/根号3),求π保留10位小数。
第一次wa的代码:

#include<bits/stdc++.h>
using namespace std;
int main(){
	cout<<"3.1415926536";
	return 0;
}

后来以为不用四舍五入

#include<bits/stdc++.h>
using namespace std;
int main(){
	cout<<"3.1415926535";
	return 0;
}

后来好好写

#include<bits/stdc++.h>
using namespace std;
double ans=0;
double f(double x){
	for(double i=1;;i+=2){
		double c=1;
		for(double j=1;j<=i;j++){
			c*=x;
		}
		if(c/i<0.000001){
			if((int)i/2%2==0){
				ans+=c/i;
			}
			else{
				ans-=c/i;
			}
			break;
		}
		else{
			if((int)i/2%2==0){
				ans+=c/i;
			}
			else{
				ans-=c/i;
			}
		}
	}
}
int main(){
	f(1/sqrt(3));
	printf("%.10lf",ans*6);
	return 0;
}

MLE 0!!!

我快被这倒水题整疯了

悬赏解决方案1+赞1

9 个赞

用函数跟你解释你肯定听不懂
所以,输出3.1415905109即可

10 个赞

谢谢

10 个赞
#include<bits/stdc++.h>
using namespace std;
int a=10000,b,c=70000,d,e,f[70001],g,n=-1,len;
char str[100005]="141";
int main(){
	scanf("%d",&len);
    for(;b-c;) f[b++]=a/5;
    for(;d=0,(g=c*2)&&n<=len;c-=14,~n&&sprintf(str+n, "%.4d",e+d/a),n+=4,e=d%a)
        for(b=c;d+=f[b]*a,f[b]=d%--g,d/=g--,--b;d*=b);
	printf("3.");
	for(register int i=0;i<len;i++) {
		if (!(i%10)) printf(" ");
		if (!(i%50)) printf("\n");
		printf("%c", str[i]);
	}
}

某个大佬教我写的计算π,len是π后len位

9 个赞

打表(可以这样说吗?),输出3.1400000000到3.1500000000之间的所有十位小数,然后依次提交上去

5 个赞

注意方式

5 个赞

那么你AC的几率约为1/1e8 :innocent:

5 个赞

铁杵磨针:innocent:

5 个赞

可以逝世

5 个赞

由于arctanx为tanx的反函数,题目给出, \pi = 6 \times arctan\frac{1}{\sqrt[]3}
tan30度= \frac{1}{\sqrt[]3} ,所以 \pi=6·30=180度
输出 180 即可
你就说对不对吧

6 个赞

不,还要保留10位,所以输出180.0000000000

6 个赞

那你怎么输出度(°)呢 :face_with_monocle:

5 个赞

自己用电脑创造一个字符 :upside_down_face:

4 个赞

I’m jokiiiiiiing

5 个赞

°°

4 个赞

。°

3 个赞

答:xyd可以下载数据

3 个赞

题库不能下载

3 个赞

确实。

2 个赞
#include <cstdio>

int main()
{
  printf("%.10lf", 3.1415905109);
  return 0;
}
2 个赞