結果

問題 No.185 和風
ユーザー kat0rikkat0rik
提出日時 2020-02-03 19:23:58
言語 Go
(1.22.1)
結果
AC  
実行時間 18 ms / 1,000 ms
コード長 260 bytes
コンパイル時間 11,250 ms
コンパイル使用メモリ 223,620 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-19 08:50:29
合計ジャッジ時間 11,971 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

package main

import "fmt"

func main() {
	var N, v int
	fmt.Scan(&N)
	for i := 0; i < N; i++ {
		var x, y int
		fmt.Scan(&x, &y)
		if v == 0 {
			if y-x > 0 {
				v = y - x
			} else {
				v = -1
			}
		} else if v != y-x {
			v = -1
		}
	}
	fmt.Println(v)
}
0