結果

問題 No.185 和風
ユーザー tsuchinagatsuchinaga
提出日時 2019-02-20 22:57:15
言語 Go
(1.22.1)
結果
AC  
実行時間 16 ms / 1,000 ms
コード長 314 bytes
コンパイル時間 16,638 ms
コンパイル使用メモリ 227,712 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-25 11:07:41
合計ジャッジ時間 13,683 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
5,248 KB
testcase_01 AC 16 ms
5,248 KB
testcase_02 AC 15 ms
5,376 KB
testcase_03 AC 16 ms
5,376 KB
testcase_04 AC 16 ms
5,376 KB
testcase_05 AC 3 ms
5,376 KB
testcase_06 AC 14 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import "fmt"

func main() {
	var n, x, y, m int
	r := true
	_, _ = fmt.Scan(&n)
	_, _ = fmt.Scan(&x, &y)
	m = y - x
	if y-x <= 0 {
		r = false
	}

	for i := 1; i < n; i++ {
		_, _ = fmt.Scan(&x, &y)

		if r && m != y-x {
			r = false
		}
	}

	if r {
		fmt.Println(m)
	} else {
		fmt.Println(-1)
	}
}
0