結果
問題 | No.185 和風 |
ユーザー | _k_a_n_i_ |
提出日時 | 2015-04-23 17:54:13 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 847 bytes |
コンパイル時間 | 1,940 ms |
コンパイル使用メモリ | 71,848 KB |
実行使用メモリ | 58,752 KB |
最終ジャッジ日時 | 2023-09-18 08:35:37 |
合計ジャッジ時間 | 3,791 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 180 ms
56,520 KB |
testcase_01 | AC | 194 ms
58,752 KB |
testcase_02 | AC | 122 ms
56,224 KB |
testcase_03 | AC | 123 ms
55,744 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | AC | 193 ms
58,680 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 : -1); } }