結果

問題 No.112 ややこしい鶴亀算
ユーザー fmhrfmhr
提出日時 2015-05-14 01:07:06
言語 Go
(1.22.1)
結果
WA  
実行時間 -
コード長 474 bytes
コンパイル時間 13,058 ms
コンパイル使用メモリ 234,648 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-18 11:09:23
合計ジャッジ時間 11,305 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 WA -
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 WA -
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 WA -
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 WA -
testcase_15 AC 1 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 1 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 WA -
testcase_21 AC 1 ms
5,376 KB
testcase_22 AC 1 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"fmt"
)

func main() {
	var N int
	fmt.Scan(&N)
	a := make([]int, N)
	var pre int
	var flag int
	var turu, turu_c int
	for i := range a {
		fmt.Scan(&a[i])
		if i > 0 {
			if a[i] > pre {
				turu_c = a[i]
			}else if a[i] < pre {
				turu_c = pre
			}
			flag = 1
		}
		pre = a[i]
	}
	if flag == 0 {
		if a[0] / (N-1) == 2 {
			turu = N
		}
	} else {
		for i := range a {
			if a[i] == turu_c {
				turu += 1
			}
		}
	}
	fmt.Println(turu, N-turu)
}
0