結果

問題 No.1180 無限和
ユーザー lam6er
提出日時 2025-03-20 20:34:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 338 ms / 1,000 ms
コード長 996 bytes
コンパイル時間 396 ms
コンパイル使用メモリ 82,296 KB
実行使用メモリ 82,684 KB
最終ジャッジ日時 2025-03-20 20:35:59
合計ジャッジ時間 14,200 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

import decimal

def main():
    n = int(input())
    # Set a high precision to handle large exponents accurately
    decimal.getcontext().prec = 2000

    # Pi as a string with 1000 decimal places (truncated here for brevity)
    pi_str = '3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593344612847564823378678316527120190914564856692346034861045432664821339360726024914127372458700660631558817488152092096282925409171536436789259036001133053054882046652138414695194151160943305727036575959195309218611738193261179310511854807446237996274956735188575272489122793818301194912'
    pi = decimal.Decimal(pi_str)
    
    value = (pi ** 2) / decimal.Decimal(6)
    s = (value ** n) / decimal.Decimal(n)
    
    # Extract the integer part
    integer_part = s // 1
    print(f"{integer_part}")

if __name__ == "__main__":
    main()
0