結果

問題 No.3072 Sum of sqrt(x)
ユーザー Lisp_CoderLisp_Coder
提出日時 2022-12-24 17:41:29
言語 Go
(1.22.1)
結果
TLE  
実行時間 -
コード長 539 bytes
コンパイル時間 11,530 ms
コンパイル使用メモリ 225,996 KB
実行使用メモリ 24,320 KB
最終ジャッジ日時 2024-04-29 04:56:02
合計ジャッジ時間 26,998 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
10,752 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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