結果

問題 No.99 ジャンピング駒
ユーザー fmhrfmhr
提出日時 2015-05-14 04:19:36
言語 Go1.4
(1.4.2)
結果
AC  
実行時間 40 ms / 5,000 ms
コード長 494 bytes
コンパイル時間 240 ms
コンパイル使用メモリ 32,932 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-16 11:52:26
合計ジャッジ時間 1,484 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
4,380 KB
testcase_01 AC 40 ms
4,380 KB
testcase_02 AC 39 ms
4,380 KB
testcase_03 AC 39 ms
4,376 KB
testcase_04 AC 40 ms
4,376 KB
testcase_05 AC 40 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

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

func main() {
	var N int
	a := make([]int64, 2)
	fmt.Scan(&N)
	for i:=0; i<N; i++{
		x := int64(nextInt())
		a[abs(x%2)] += 1
	}
	fmt.Println(abs(a[0]-a[1]))
}

func abs(x int64) int64{
	return int64(math.Abs(float64(x)))
}

var s = bufio.NewScanner(os.Stdin)
func next() string {
	s.Split(bufio.ScanWords)
	s.Scan()
	return s.Text()
}
func nextInt() int {
	i, e := strconv.Atoi(next())
	if e != nil {
		panic(e)
	}
	return i
}
0