結果

問題 No.185 和風
ユーザー tsuchinagatsuchinaga
提出日時 2019-02-20 22:57:15
言語 Go
(1.22.1)
結果
AC  
実行時間 17 ms / 1,000 ms
コード長 314 bytes
コンパイル時間 12,833 ms
コンパイル使用メモリ 213,176 KB
実行使用メモリ 4,376 KB
最終ジャッジ日時 2023-08-07 17:31:40
合計ジャッジ時間 13,547 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
4,376 KB
testcase_01 AC 16 ms
4,360 KB
testcase_02 AC 16 ms
4,364 KB
testcase_03 AC 16 ms
4,356 KB
testcase_04 AC 17 ms
4,360 KB
testcase_05 AC 3 ms
4,360 KB
testcase_06 AC 13 ms
4,364 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