結果

問題 No.112 ややこしい鶴亀算
コンテスト
ユーザー tsuchinaga
提出日時 2019-03-02 01:02:07
言語 Go
(1.26.1)
コンパイル:
env GOCACHE=/tmp go build _filename_
実行:
./Main
結果
AC  
実行時間 1 ms / 5,000 ms
+ 327µs
コード長 360 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 10,791 ms
コンパイル使用メモリ 294,884 KB
実行使用メモリ 5,888 KB
最終ジャッジ日時 2026-07-27 20:58:18
合計ジャッジ時間 11,646 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

package main

import "fmt"

func main() {
	var n, a, b, c int
	_, _ = fmt.Scan(&n)
	as := make(map[int]int, 0)

	max := 0
	for i := 0; i < n; i++ {
		_, _ = fmt.Scan(&a)
		as[a]++
		if max < a {
			max = a
		}
	}

	if len(as) == 2 {
		b, c = as[max], n-as[max]
	} else {
		if max/(n-1) == 2 {
			b = n
		} else {
			c = n
		}
	}
	fmt.Printf("%d %d\n", b, c)
}
0