結果

問題 No.8072 Sum of sqrt(x)
ユーザー NixOS_and_Gentoo
提出日時 2022-12-24 17:41:29
言語 Go
(1.27.0 + ACL)
コンパイル:
/usr/bin/go_c
実行:
./Main
結果
OLE  
実行時間 -
コード長 539 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 14,072 ms
コンパイル使用メモリ 261,868 KB
実行使用メモリ 21,100 KB
最終ジャッジ日時 2026-09-25 16:26:59
合計ジャッジ時間 49,116 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 5 TLE * 1 OLE * 2 -- * 19
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

package main

import (
	"fmt"
	"math"
)

func main() {
	// Read in the sequence length N
	var N int
	fmt.Scanf("%d", &N)

	// Read in the sequence
	sequence := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scanf("%d", &sequence[i])
	}

	// Initialize a variable to store the sum of sqrt(xi) for i = 0 to i = k
	var sum float64

	// Iterate over the sequence
	for k := 0; k < N; k++ {
		// Add the square root of the current element to the sum
		sum += math.Sqrt(float64(sequence[k]))

		// Print the sum
		fmt.Printf("%.16f\n", sum)
	}
}
0