結果

問題 No.3072 Sum of sqrt(x)
ユーザー 259_Momone259_Momone
提出日時 2020-09-12 22:56:53
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
OLE  
実行時間 -
コード長 584 bytes
コンパイル時間 5,887 ms
コンパイル使用メモリ 200,084 KB
実行使用メモリ 18,880 KB
最終ジャッジ日時 2023-08-30 19:30:59
合計ジャッジ時間 67,332 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,356 KB
testcase_01 AC 1 ms
4,356 KB
testcase_02 AC 2 ms
4,360 KB
testcase_03 AC 1 ms
4,352 KB
testcase_04 AC 2 ms
4,356 KB
testcase_05 AC 2 ms
4,352 KB
testcase_06 AC 2 ms
4,352 KB
testcase_07 OLE -
testcase_08 AC 699 ms
18,880 KB
testcase_09 OLE -
testcase_10 OLE -
testcase_11 OLE -
testcase_12 OLE -
testcase_13 OLE -
testcase_14 OLE -
testcase_15 OLE -
testcase_16 OLE -
testcase_17 OLE -
testcase_18 OLE -
testcase_19 OLE -
testcase_20 OLE -
testcase_21 OLE -
testcase_22 OLE -
testcase_23 OLE -
testcase_24 OLE -
testcase_25 OLE -
testcase_26 OLE -
testcase_27 OLE -
testcase_28 OLE -
testcase_29 OLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

int main(){
    using namespace std;
    unsigned long N;
    cin >> N;
    vector<long double> v(N + 1);
    transform(istream_iterator<unsigned long>(cin), istream_iterator<unsigned long>(), begin(v) + 1, [](const unsigned long& x){return sqrtl(x);});
    for(unsigned long i{1}; i <= N; i <<= 1UL)for(unsigned long j{2 * i}; j <= N; j += 2 * i)v[j] += v[j - i];
    for(unsigned long i{1}; i <= N; ++i)v[i] += v[i & (i - 1)];
    cout << setprecision(16) << fixed;
    copy(begin(v) + 1, end(v), ostream_iterator<long double>(cout, "\n"));
    return 0;
}
0