結果

問題 No.8072 Sum of sqrt(x)
ユーザー hgoto
提出日時 2020-09-26 13:26:25
言語 C++17(gcc12)
(gcc 12.4.0 + boost 1.90.0)
コンパイル:
g++-12 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
OLE  
実行時間 -
コード長 227 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,593 ms
コンパイル使用メモリ 198,492 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-06-14 02:08:04
合計ジャッジ時間 24,327 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 5 OLE * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |   scanf("%d", &n);
      |   ~~~~~^~~~~~~~~~

ソースコード

diff #
raw source code

#include <bits/stdc++.h>

using namespace std;

int main() {
  int n;
  scanf("%d", &n);
  long double ans = 0;
  while (n--) {
    long double x;
    cin >> x;
    ans += sqrt(x);
    printf("%.17Lf\n", ans);
  }
  return 0;
}
0