結果
問題 | No.185 和風 |
ユーザー | _k_a_n_i_ |
提出日時 | 2015-04-23 18:03:57 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 195 ms / 1,000 ms |
コード長 | 858 bytes |
コンパイル時間 | 1,967 ms |
コンパイル使用メモリ | 71,488 KB |
実行使用メモリ | 58,908 KB |
最終ジャッジ日時 | 2023-09-18 08:35:43 |
合計ジャッジ時間 | 3,765 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 183 ms
56,020 KB |
testcase_01 | AC | 194 ms
58,432 KB |
testcase_02 | AC | 124 ms
55,960 KB |
testcase_03 | AC | 124 ms
57,596 KB |
testcase_04 | AC | 195 ms
58,592 KB |
testcase_05 | AC | 144 ms
55,952 KB |
testcase_06 | AC | 195 ms
58,908 KB |
ソースコード
import java.util.Scanner; public class Main { private final static Main main = new Main(); public static void main(String[] args) { long l = System.currentTimeMillis(); main.solve(); //System.out.println("処理時間:" + (System.currentTimeMillis() - l)); } private void solve() { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int ans = (sc.nextInt()-sc.nextInt())*-1; boolean flag = false; for(int i=1; i<n; ++i) { int x = sc.nextInt(); int y = sc.nextInt(); if(ans + x == y) { flag = true; } else { flag = false; break; } } System.out.println(flag && ans > 0 ? ans : -1); } }