結果

問題 No.185 和風
ユーザー Mcpu3Mcpu3
提出日時 2018-06-22 01:22:42
言語 Java21
(openjdk 21)
結果
AC  
実行時間 196 ms / 1,000 ms
コード長 339 bytes
コンパイル時間 1,926 ms
コンパイル使用メモリ 71,856 KB
実行使用メモリ 58,408 KB
最終ジャッジ日時 2023-09-13 07:47:46
合計ジャッジ時間 3,685 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 177 ms
56,160 KB
testcase_01 AC 196 ms
58,004 KB
testcase_02 AC 123 ms
55,852 KB
testcase_03 AC 120 ms
55,968 KB
testcase_04 AC 120 ms
56,204 KB
testcase_05 AC 121 ms
55,856 KB
testcase_06 AC 190 ms
58,408 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class no185{
	public static void main(String[] args) {
		Scanner stdIn=new Scanner(System.in);
		int n,x,y,i,t=0;
		n=stdIn.nextInt();
		for(i=0;i<n;i++) {
			x=stdIn.nextInt();
			y=stdIn.nextInt();
			if(i>0&&t!=y-x||x>=y) {
				t=-1;
				break;
			}
			t=y-x;
		}
		System.out.print(t);
	}
}
0