結果
問題 |
No.45 回転寿司
|
ユーザー |
![]() |
提出日時 | 2019-06-18 13:27:43 |
言語 | Go (1.23.4) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 498 bytes |
コンパイル時間 | 13,644 ms |
コンパイル使用メモリ | 235,568 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-27 20:37:39 |
合計ジャッジ時間 | 12,711 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
ソースコード
package main import ( "bufio" "fmt" "math" "os" "strconv" ) func main() { sc := bufio.NewScanner(os.Stdin) sc.Split(bufio.ScanWords) sc.Scan() n, _ := strconv.Atoi(sc.Text()) var a, b, c float64 // 取った、取った後やから取れへん、取れるけど取らへん for i := 0; i < n; i++ { sc.Scan() v, _ := strconv.Atoi(sc.Text()) // fmt.Println(a, b, c, v) larger := math.Max(b, c) a, b, c = larger+float64(v), a, larger } fmt.Println(int(math.Max(a, b))) }