結果

問題 No.1539 不可欠な部分
ユーザー vkgainzvkgainz
提出日時 2021-06-12 06:47:59
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
AC  
実行時間 1,133 ms / 2,000 ms
コード長 576 bytes
コンパイル時間 5,344 ms
コンパイル使用メモリ 130,652 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-22 02:51:13
合計ジャッジ時間 44,644 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 603 ms
4,376 KB
testcase_02 AC 707 ms
4,376 KB
testcase_03 AC 311 ms
4,384 KB
testcase_04 AC 262 ms
4,380 KB
testcase_05 AC 203 ms
4,384 KB
testcase_06 AC 352 ms
4,384 KB
testcase_07 AC 90 ms
4,380 KB
testcase_08 AC 196 ms
4,380 KB
testcase_09 AC 594 ms
4,380 KB
testcase_10 AC 631 ms
4,384 KB
testcase_11 AC 706 ms
4,384 KB
testcase_12 AC 704 ms
4,384 KB
testcase_13 AC 708 ms
4,380 KB
testcase_14 AC 707 ms
4,380 KB
testcase_15 AC 709 ms
4,384 KB
testcase_16 AC 1,133 ms
4,380 KB
testcase_17 AC 1,130 ms
4,380 KB
testcase_18 AC 697 ms
4,384 KB
testcase_19 AC 695 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

double eval(double x, int N) {
    return exp(cos(x / N));
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int T; cin >> T;
    double mx = 1/(exp(1) * M_PI * M_PI);
    cout << setprecision(24);
    while(T--) {
        int N; cin >> N;
        int blocks = 200;
        double dx = mx / blocks;
        double ans = 0.0;
        for(double x = 0; x < mx; x += dx) {
            double mid = (x + x + dx) / 2;
            ans += eval(mid, N) * dx;
        }
        cout << ans << "\n";
    }
}
0