from math import*
n=int(input())
PI=n/2*(sqrt(2-2*cos(radians(360/n))))
print(PI)
测试结果:
n=192,PI=3.1414524722853443
n=3072,PI=3.1415921059596714
n=100000,PI=3.1415926817539495
from math import*
n=int(input())
PI=n/2*(sqrt(2-2*cos(radians(360/n))))
print(PI)
测试结果:
n=192,PI=3.1414524722853443
n=3072,PI=3.1415921059596714
n=100000,PI=3.1415926817539495