結果
問題 |
No.8072 Sum of sqrt(x)
|
ユーザー |
|
提出日時 | 2022-12-24 17:45:03 |
言語 | Go (1.23.4) |
結果 |
TLE
|
実行時間 | - |
コード長 | 568 bytes |
コンパイル時間 | 12,812 ms |
コンパイル使用メモリ | 222,900 KB |
実行使用メモリ | 40,076 KB |
最終ジャッジ日時 | 2024-11-18 05:27:50 |
合計ジャッジ時間 | 91,333 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 4 TLE * 23 |
ソースコード
package main import ( "bufio" "fmt" "math" "os" ) func main() { // use bufio for fast I/O scanner := bufio.NewScanner(os.Stdin) // read the length of the sequence var n int scanner.Scan() fmt.Sscan(scanner.Text(), &n) // read the sequence var x []int for i := 0; i < n; i++ { var xi int scanner.Scan() fmt.Sscan(scanner.Text(), &xi) x = append(x, xi) } // compute the sum of sqrt(xi) for each k for k := 0; k < n; k++ { var sum float64 for i := 0; i <= k; i++ { sum += math.Sqrt(float64(x[i])) } fmt.Printf("%.16f\n", sum) } }