結果

問題 No.182 新規性の虜
ユーザー t_murano
提出日時 2016-07-10 15:14:38
言語 Go
(1.23.4)
結果
AC  
実行時間 29 ms / 5,000 ms
コード長 762 bytes
コンパイル時間 11,445 ms
コンパイル使用メモリ 220,116 KB
実行使用メモリ 7,296 KB
最終ジャッジ日時 2024-12-27 05:29:56
合計ジャッジ時間 13,078 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"bufio"
	"fmt"
	"log"
	"os"
	"strconv"
	"strings"
)

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		log.Fatal(err)
	}
	return i
}

func nextIntList(sc *bufio.Scanner) []int {
	sc.Scan()
	input := strings.Split(sc.Text(), " ")
	result := make([]int, len(input))
	for i, v := range input {
		if j, err := strconv.Atoi(v); err != nil {
			log.Fatal(err)
		} else {
			result[i] = j
		}
	}
	return result
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	n := nextInt(sc)
	counter := map[int]int{}
	result := 0

	for i := 0; i < n; i++ {
		counter[nextInt(sc)] += 1
	}
	for _, v := range counter {
		if v == 1 {
			result += 1
		}
	}
	fmt.Println(result)
}
0