結果
問題 | No.29 パワーアップ |
ユーザー |
![]() |
提出日時 | 2016-07-10 17:08:46 |
言語 | Go (1.23.4) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 528 bytes |
コンパイル時間 | 14,979 ms |
コンパイル使用メモリ | 227,820 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-13 10:24:39 |
合計ジャッジ時間 | 15,305 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 22 |
ソースコード
package main import ( "bufio" "fmt" "log" "os" "strconv" ) func nextInt(sc *bufio.Scanner) int { sc.Scan() i, err := strconv.Atoi(sc.Text()) if err != nil { log.Fatal(err) } return i } func main() { sc := bufio.NewScanner(os.Stdin) sc.Split(bufio.ScanWords) n := nextInt(sc) var counter [11]int for i := 0; i < n*3; i++ { counter[nextInt(sc)] += 1 } powerUp := 0 remaining := 0 for _, c := range counter { powerUp += c / 2 remaining += c % 2 } powerUp += remaining / 4 fmt.Println(powerUp) }