#include<stdio.h> #include<stdlib.h> double PAI(int n) { double pai; if(n==1) { pai=2/3; return 2/3; } else { pai=PAI(n-1)+1/(4*n-3)-1/(4n-1); return pai; } int main() { int n; scanf("%d",&n); printf("%lf",PAI(n)); return 0; }
Yexiaomo
相关分类