結果
問題 | No.99 ジャンピング駒 |
ユーザー |
![]() |
提出日時 | 2016-06-11 16:25:53 |
言語 | Go (1.23.4) |
結果 |
AC
|
実行時間 | 13 ms / 5,000 ms |
コード長 | 492 bytes |
コンパイル時間 | 14,791 ms |
コンパイル使用メモリ | 220,696 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-11 05:12:30 |
合計ジャッジ時間 | 15,840 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 |
ソースコード
package mainimport ("bufio""fmt""os""strconv")func nextInt(sc *bufio.Scanner) int {sc.Scan()i, e := strconv.Atoi(sc.Text())if e != nil {panic(e)}return i}func absInt(num int) int {if num < 0 {return -num}return num}func main() {sc := bufio.NewScanner(os.Stdin)sc.Split(bufio.ScanWords)n := nextInt(sc)count := 0for i := 0; i < n; i++ {if nextInt(sc)%2 == 0 {count += 1} else {count -= 1}}fmt.Println(absInt(count))}