結果
問題 | No.185 和風 |
ユーザー |
![]() |
提出日時 | 2017-10-03 09:15:50 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 191 ms / 1,000 ms |
コード長 | 506 bytes |
コンパイル時間 | 2,105 ms |
コンパイル使用メモリ | 74,276 KB |
実行使用メモリ | 43,352 KB |
最終ジャッジ日時 | 2024-11-16 05:25:06 |
合計ジャッジ時間 | 3,956 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 7 |
ソースコード
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); } } }