結果
| 問題 | No.8072 Sum of sqrt(x) |
| ユーザー |
👑 |
| 提出日時 | 2025-11-04 23:16:01 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 1,285 ms / 2,000 ms |
| コード長 | 337 bytes |
| 記録 | |
| コンパイル時間 | 884 ms |
| コンパイル使用メモリ | 99,028 KB |
| 実行使用メモリ | 7,720 KB |
| 最終ジャッジ日時 | 2025-11-04 23:18:30 |
| 合計ジャッジ時間 | 145,158 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:15: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | int n; scanf("%d", &n);
| ~~~~~^~~~~~~~~~
main.cpp:10:16: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
10 | ll x; scanf("%lld", &x);
| ~~~~~^~~~~~~~~~~~
ソースコード
#include <stdio.h>
#include <cmath>
#include <iostream>
using ld = long double;
using ll = long long;
int main() {
int n; scanf("%d", &n);
ld ans = 0, res = 0;
for(;n --;) {
ll x; scanf("%lld", &x);
ld a = sqrt((ld)x);
ld t = ans + a + res;
res = a + res - (t - ans);
ans = t;
printf("%.16Lg\n", ans);
}
}