結果
問題 |
No.8072 Sum of sqrt(x)
|
ユーザー |
|
提出日時 | 2022-12-24 17:41:29 |
言語 | Go (1.23.4) |
結果 |
TLE
|
実行時間 | - |
コード長 | 539 bytes |
コンパイル時間 | 15,511 ms |
コンパイル使用メモリ | 221,592 KB |
実行使用メモリ | 26,880 KB |
最終ジャッジ日時 | 2024-11-18 05:26:16 |
合計ジャッジ時間 | 95,976 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 4 TLE * 23 |
ソースコード
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) } }