結果

問題 No.8072 Sum of sqrt(x)
ユーザー くろん
提出日時 2023-09-21 20:53:01
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 282 bytes
コンパイル時間 1,829 ms
コンパイル使用メモリ 66,560 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-07 14:17:20
合計ジャッジ時間 30,635 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other AC * 2 WA * 23 TLE * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:16:16: warning: 'result' may be used uninitialized [-Wmaybe-uninitialized]
   16 |         result += sqrt(x_i);
      |         ~~~~~~~^~~~~~~~~~~~
main.cpp:9:12: note: 'result' was declared here
    9 |     double result;
      |            ^~~~~~

ソースコード

diff #

#include <iostream>
#include <string>
#include <cmath>

using namespace std;

int main() {
    int N;
    double result;
    
    cin >> N;
    for(int i = 0; i < N; i++){
    	int x_i;
    	cin >> x_i;
    	
    	result += sqrt(x_i);
    	cout << result;
    }
    
    return 0;
}
0