結果
問題 |
No.8072 Sum of sqrt(x)
|
ユーザー |
![]() |
提出日時 | 2020-09-12 23:05:03 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
OLE
|
実行時間 | - |
コード長 | 452 bytes |
コンパイル時間 | 2,992 ms |
コンパイル使用メモリ | 195,556 KB |
最終ジャッジ日時 | 2025-01-14 13:59:37 |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 4 OLE * 23 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:6:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 6 | scanf("%lu", &N); | ~~~~~^~~~~~~~~~~ main.cpp:9:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | scanf("%lu", &t); | ~~~~~^~~~~~~~~~~
ソースコード
#include<bits/stdc++.h> int main(){ using namespace std; unsigned long N; scanf("%lu", &N); vector<long double> v(N + 1); for(unsigned long i{1}, t; i <= N; ++i){ scanf("%lu", &t); v[i] = sqrtl(t); } 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)printf("%.18Lf\n", v[i] += v[i & (i - 1)]); return 0; }