結果

問題 No.586 ダブルブッキング
ユーザー k.h
提出日時 2019-08-06 13:55:41
言語 Go
(1.23.4)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 451 bytes
コンパイル時間 12,036 ms
コンパイル使用メモリ 221,808 KB
実行使用メモリ 6,940 KB
最終ジャッジ日時 2024-07-18 13:55:15
合計ジャッジ時間 12,183 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Scan()
	p1, _ := strconv.Atoi(sc.Text())
	sc.Scan()
	p2, _ := strconv.Atoi(sc.Text())
	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	r := make(map[int]int, n)
	loss := 0
	for i := 0; i < n; i++ {
		sc.Scan()
		t, _ := strconv.Atoi(sc.Text())
		if r[t] >= 1 {
			loss += p1 + p2
		}
		r[t]++
	}
	fmt.Println(loss)
}
0