結果
問題 | No.112 ややこしい鶴亀算 |
ユーザー |
![]() |
提出日時 | 2016-09-08 23:47:45 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 164 ms / 5,000 ms |
コード長 | 572 bytes |
コンパイル時間 | 3,762 ms |
コンパイル使用メモリ | 76,368 KB |
実行使用メモリ | 42,548 KB |
最終ジャッジ日時 | 2024-11-15 22:30:30 |
合計ジャッジ時間 | 8,473 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 23 |
ソースコード
import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(), max = 0, min = 200, t, x, y; for (int i = 0; i < n; i++) { t = sc.nextInt(); max = Math.max(max, t); min = Math.min(min, t); } if (max == min) { if ((n - 1) * 2 == max) { System.out.println(n + " 0"); } else { System.out.println("0 " + n); } } else { x = n; y = 0; min += 4; while (x * 2 + y * 4 != min) { x--; y++; } System.out.println(x + " " + y); } } }