結果
問題 |
No.9008 空白区切りで与えられる数値データの合計値を求める(テスト用)
|
ユーザー |
|
提出日時 | 2018-10-24 07:41:12 |
言語 | Go (1.23.4) |
結果 |
AC
|
実行時間 | 24 ms / 2,000 ms |
コード長 | 667 bytes |
コンパイル時間 | 16,758 ms |
コンパイル使用メモリ | 239,192 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-19 04:57:31 |
合計ジャッジ時間 | 14,059 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 15 |
ソースコード
package main import ( "fmt" "os" "bufio" "strconv" ) var sc = bufio.NewScanner(os.Stdin) func main() { sc.Split(bufio.ScanWords) // code goes here n := nextInt() total := int64(0) for i := int64(0); i < n; i += 1 { total += nextInt() } fmt.Println(total) } func nextInt() int64 { sc.Scan() v, e := strconv.ParseInt(sc.Text(), 10, 64) if e != nil { panic(e) } return v } func nextString() string { sc.Scan() return sc.Text() } func nextFloat() float64 { sc.Scan() v, e := strconv.ParseFloat(sc.Text(), 64) if e != nil { panic(e) } return v }