結果

問題 No.45 回転寿司
ユーザー tsuchinagatsuchinaga
提出日時 2019-06-18 13:25:06
言語 Go
(1.22.1)
結果
WA  
実行時間 -
コード長 490 bytes
コンパイル時間 12,350 ms
コンパイル使用メモリ 209,908 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-20 07:01:32
合計ジャッジ時間 13,986 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

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 int // 取った、取った後やから取れへん、取れるけど取らへん
	for i := 0; i < n; i++ {
		sc.Scan()
		v, _ := strconv.Atoi(sc.Text())

		// fmt.Println(a, b, c, v)
		larger := int(math.Max(float64(b), float64(c)))
		a, b, c = larger+v, a, larger
	}

	fmt.Println(a)
}
0