結果

問題 No.1004 サイコロの実装 (2)
ユーザー oshou
提出日時 2020-03-09 07:47:36
言語 Go
(1.23.4)
結果
WA  
実行時間 -
コード長 515 bytes
コンパイル時間 11,378 ms
コンパイル使用メモリ 234,124 KB
実行使用メモリ 10,496 KB
最終ジャッジ日時 2024-11-07 20:46:23
合計ジャッジ時間 15,366 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 6 WA * 18 TLE * 1 -- * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import "fmt"

func min(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}

func main() {
	var a, b, x, x0, n int
	var tak_odd, tak_even int
	var aoki_odd, aoki_even int
	fmt.Scan(&a, &b, &x0, &n)
	x = x0
	for i := 0; i < n*2; i++ {
		x = (a*x + b) % 6
		if i%2 == 0 {
			if (x+1)%2 == 0 {
				tak_even++
			} else {
				tak_odd++
			}
		} else {
			if (x+1)%2 == 0 {
				aoki_even++
			} else {
				aoki_odd++
			}
		}
	}
	fmt.Println(min(tak_even, tak_odd), min(aoki_even, aoki_odd))
}
0