結果

問題 No.524 コインゲーム
ユーザー fmhrfmhr
提出日時 2017-06-03 00:08:56
言語 Go
(1.22.1)
結果
WA  
実行時間 -
コード長 382 bytes
コンパイル時間 12,840 ms
コンパイル使用メモリ 226,068 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-22 02:00:16
合計ジャッジ時間 16,738 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

package main

import "fmt"

func main() {
	var N uint
	fmt.Scan(&N)
	var i, ma, x uint
	for i = 1; i < N; i++ {
		x ^= i
		ma = max(ma, i)
	}
	var ans string
	if ma < 2 {
		if N&1 == 1 {
			ans = "O"
		} else {
			ans = "X"
		}
	} else {
		if x != 0 {
			ans = "X"
		} else {
			ans = "O"
		}
	}
	fmt.Println(ans)
}

func max(a, b uint) uint {
	if a > b {
		return a
	}
	return b
}
0