結果

問題 No.185 和風
ユーザー tsuchinagatsuchinaga
提出日時 2019-02-20 22:56:25
言語 Go
(1.22.1)
結果
WA  
実行時間 -
コード長 313 bytes
コンパイル時間 15,111 ms
コンパイル使用メモリ 236,664 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-25 11:03:50
合計ジャッジ時間 12,422 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 7 ms
5,248 KB
testcase_01 AC 16 ms
5,248 KB
testcase_02 AC 15 ms
5,376 KB
testcase_03 AC 15 ms
5,376 KB
testcase_04 AC 14 ms
5,376 KB
testcase_05 WA -
testcase_06 AC 13 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