結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー tsuchinagatsuchinaga
提出日時 2019-04-19 08:25:51
言語 Go
(1.22.1)
結果
AC  
実行時間 187 ms / 5,000 ms
コード長 484 bytes
コンパイル時間 14,348 ms
コンパイル使用メモリ 211,240 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-14 16:04:19
合計ジャッジ時間 15,024 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,504 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 167 ms
4,376 KB
testcase_08 AC 165 ms
4,380 KB
testcase_09 AC 114 ms
4,380 KB
testcase_10 AC 138 ms
4,376 KB
testcase_11 AC 180 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 187 ms
4,380 KB
testcase_15 AC 186 ms
4,376 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 43 ms
4,380 KB
testcase_18 AC 162 ms
4,380 KB
testcase_19 AC 22 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

func main() {
	var n int
	_, _ = fmt.Scan(&n)
	max := int(math.Pow(2, 15))

	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	res := make([]bool, max)
	res[0] = true
	for i := 0; i < n; i++ {
		sc.Scan()
		a, _ := strconv.Atoi(sc.Text())

		for j := 0; j < max; j++ {
			if res[j] {
				res[j^a] = true
			}
		}
	}

	ans := 0
	for j := 0; j < max; j++ {
		if res[j] {
			ans++
		}
	}
	fmt.Println(ans)
}
0