結果
| 問題 | 
                            No.1539 不可欠な部分
                             | 
                    
| コンテスト | |
| ユーザー | 
                             lam6er
                         | 
                    
| 提出日時 | 2025-03-20 20:44:22 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 278 ms / 2,000 ms | 
| コード長 | 980 bytes | 
| コンパイル時間 | 307 ms | 
| コンパイル使用メモリ | 82,300 KB | 
| 実行使用メモリ | 111,340 KB | 
| 最終ジャッジ日時 | 2025-03-20 20:44:47 | 
| 合計ジャッジ時間 | 22,308 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 20 | 
ソースコード
import math
def main():
    import sys
    input = sys.stdin.read
    data = input().split()
    T = int(data[0])
    a = 1.0 / (math.e * (math.pi ** 2))
    
    nodes = [
        -0.906179845938664,
        -0.538469310105683,
        0.0,
        0.538469310105683,
        0.906179845938664
    ]
    weights = [
        0.236926885056189,
        0.478628670499366,
        0.568888888888889,
        0.478628670499366,
        0.236926885056189
    ]
    
    results = []
    for i in range(1, T + 1):
        N = int(data[i])
        b = a / N
        if b == 0:
            integral = 0.0
        else:
            integral = 0.0
            for x, w in zip(nodes, weights):
                t = 0.5 * (x + 1) * b
                integral += w * math.exp(math.cos(t))
            integral *= 0.5 * b
        result = integral * N
        results.append("{0:.10f}".format(result))
    
    sys.stdout.write("\n".join(results) + "\n")
if __name__ == "__main__":
    main()
            
            
            
        
            
lam6er