結果
問題 |
No.8072 Sum of sqrt(x)
|
ユーザー |
![]() |
提出日時 | 2020-06-05 19:52:46 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 1,592 ms / 2,000 ms |
コード長 | 309 bytes |
コンパイル時間 | 586 ms |
コンパイル使用メモリ | 49,536 KB |
最終ジャッジ日時 | 2025-01-10 21:54:11 |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
コンパイルメッセージ
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("%d", &n); | ~~~~~^~~~~~~~~~ main.cpp:10:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 | scanf("%lf", &x); | ~~~~~^~~~~~~~~~~
ソースコード
#include <cstdio> #include <cmath> int main() { int n; scanf("%d", &n); double s = 0, t, r = 0; for (int i = 0; i < n; i++) { double x; scanf("%lf", &x); x = sqrt(x) + r; t = s + x; r = x - (t - s); s = t; printf("%.17g\n", s); } }