結果

問題 No.8072 Sum of sqrt(x)
ユーザー trineutron
提出日時 2020-06-05 18:38:27
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 279 bytes
コンパイル時間 695 ms
コンパイル使用メモリ 50,176 KB
最終ジャッジ日時 2025-01-10 21:41:44
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26 TLE * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:10:19: warning: use of ‘ll’ length modifier with ‘f’ type character has either no effect or undefined behavior [-Wformat=]
   10 |         scanf("%llf", &x);
      |                   ^
main.cpp:13:23: warning: use of ‘ll’ length modifier with ‘g’ type character has either no effect or undefined behavior [-Wformat=]
   13 |         printf("%.17llg\n", (long double) s);
      |                       ^
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("%llf", &x);
      |         ~~~~~^~~~~~~~~~~~

ソースコード

diff #

#include <cstdio>
#include <cmath>

int main() {
    int n;
    scanf("%d", &n);
    __float128 s = 0;
    for (int i = 0; i < n; i++) {
        long double x;
        scanf("%llf", &x);
        x = sqrtl(x);
        s += x;
        printf("%.17llg\n", (long double) s);
    }
}
0