結果

問題 No.99 ジャンピング駒
ユーザー yukirin
提出日時 2015-05-12 20:52:22
言語 Go
(1.23.4)
結果
AC  
実行時間 317 ms / 5,000 ms
コード長 568 bytes
コンパイル時間 10,755 ms
コンパイル使用メモリ 237,028 KB
実行使用メモリ 7,768 KB
最終ジャッジ日時 2024-10-10 04:18:24
合計ジャッジ時間 12,797 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

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

func main() {
	var n, v int
	nums := make([]int, 0, 100)

	fmt.Scanln(&n)

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

	for scanner.Scan() {
		v, _ = strconv.Atoi((scanner.Text()))
		nums = append(nums, v)
	}

	sort.Ints(nums)

	for len(nums) > 1 {
		l := len(nums)

		for i := 0; i < len(nums)-1; {
			if (nums[i+1]-nums[i])%2 == 1 {
				nums = append(nums[:i], nums[i+2:]...)
				continue
			}
			i++
		}

		if len(nums) == l {
			break
		}
	}

	fmt.Println(len(nums))
}
0