結果
| 問題 |
No.112 ややこしい鶴亀算
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-05-12 18:01:47 |
| 言語 | Go (1.23.4) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 645 bytes |
| コンパイル時間 | 11,744 ms |
| コンパイル使用メモリ | 231,592 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-10 04:07:14 |
| 合計ジャッジ時間 | 12,024 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 22 WA * 1 |
ソースコード
package main
import (
"bufio"
"fmt"
"os"
"strconv"
"strings"
)
func main() {
var n, t, c int
keys := make([]int, 0, 2)
uniqs := make(map[int]int)
fmt.Scanln(&n)
scanner := bufio.NewScanner(os.Stdin)
scanner.Scan()
for _, v := range strings.Fields(scanner.Text()) {
val, _ := strconv.Atoi(v)
uniqs[val]++
}
for k := range uniqs {
keys = append(keys, k)
}
if len(keys) == 2 {
if keys[0] < keys[1] {
t, c = uniqs[keys[0]], uniqs[keys[1]]
} else {
t, c = uniqs[keys[1]], uniqs[keys[0]]
}
} else {
if (keys[0]+2)%n == 0 {
c = uniqs[keys[0]]
} else {
t = uniqs[keys[0]]
}
}
fmt.Println(c, t)
}