結果
| 問題 |
No.8072 Sum of sqrt(x)
|
| ユーザー |
trineutron
|
| 提出日時 | 2020-06-07 18:51:26 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 307 bytes |
| コンパイル時間 | 698 ms |
| コンパイル使用メモリ | 50,048 KB |
| 最終ジャッジ日時 | 2025-01-10 23:56:38 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 TLE * 2 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:14:23: warning: use of ‘ll’ length modifier with ‘g’ type character has either no effect or undefined behavior [-Wformat=]
14 | printf("%.17llg\n", (long double) s);
| ^
main.cpp:7:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | scanf("%d", &n);
| ~~~~~^~~~~~~~~~
main.cpp:9:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
9 | scanf("%ld", &x[i]);
| ~~~~~^~~~~~~~~~~~~~
ソースコード
#include <cstdio>
#include <cmath>
int main() {
int n;
long x[1000000];
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%ld", &x[i]);
}
__float128 s = 0;
for (int i = 0; i < n; i++) {
s += sqrtl(x[i]);
printf("%.17llg\n", (long double) s);
}
}
trineutron