結果
問題 |
No.112 ややこしい鶴亀算
|
ユーザー |
![]() |
提出日時 | 2017-10-13 14:06:43 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 170 ms / 5,000 ms |
コード長 | 760 bytes |
コンパイル時間 | 4,486 ms |
コンパイル使用メモリ | 86,452 KB |
実行使用メモリ | 55,244 KB |
最終ジャッジ日時 | 2024-11-17 11:24:16 |
合計ジャッジ時間 | 7,436 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 23 |
ソースコード
import java.util.Arrays; import java.util.Collections; import java.util.Scanner; /** * Created by btk on 2017/10/13. */ public class Main { public static void main(String[] args){ Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = sc.nextInt(); } Arrays.sort(a); int front = a[0]; int back = a[n-1]; if(front == back){ if(2*(n-1)==front){ System.out.println(n+" "+0); } else{ System.out.println(0+" "+n); } } else{ int m = (back-(n-1)*2)/2; System.out.println(n-m+" "+m); } sc.close(); } }