結果
問題 | No.185 和風 |
ユーザー |
![]() |
提出日時 | 2015-04-19 23:29:21 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 193 ms / 1,000 ms |
コード長 | 457 bytes |
コンパイル時間 | 2,913 ms |
コンパイル使用メモリ | 74,380 KB |
実行使用メモリ | 43,640 KB |
最終ジャッジ日時 | 2024-07-04 18:23:56 |
合計ジャッジ時間 | 3,674 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 7 |
ソースコード
package yukicoder;import java.util.Scanner;public class Main {public static void main(String[] args) {Scanner sc = new Scanner(System.in);int N = sc.nextInt();int candidate = 0;for (int i = 0; i < N; i++) {int x = sc.nextInt();int y = sc.nextInt();if (i == 0) {candidate = y - x;}if (candidate <= 0 || candidate != y - x) {System.out.println(-1);return;}}System.out.println(candidate);}}