結果
問題 |
No.185 和風
|
ユーザー |
![]() |
提出日時 | 2017-10-03 09:15:18 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 505 bytes |
コンパイル時間 | 2,342 ms |
コンパイル使用メモリ | 74,588 KB |
実行使用メモリ | 56,872 KB |
最終ジャッジ日時 | 2024-11-16 05:24:53 |
合計ジャッジ時間 | 4,438 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 WA * 1 |
ソースコード
import java.util.Arrays; import java.util.Scanner; public class Main{ private static Scanner sc=new Scanner(System.in); public static void main(String args[])throws Exception{ int n=sc.nextInt(),are[]=new int[n]; for(int i=0;i<n;i++){ are[i]=-(sc.nextInt()-sc.nextInt()); }Arrays.sort(are); int min=are[0]; if(min<0)System.out.println(-1); else{ for(int i=0;i<are.length;i++){ if(min != are[i]){ System.out.println(-1); return; } }System.out.println(min); } } }