結果

問題 No.112 ややこしい鶴亀算
ユーザー htensai
提出日時 2019-12-05 16:02:34
言語 Java
(openjdk 23)
結果
AC  
実行時間 174 ms / 5,000 ms
コード長 372 bytes
コンパイル時間 2,848 ms
コンパイル使用メモリ 76,072 KB
実行使用メモリ 54,996 KB
最終ジャッジ日時 2024-12-18 00:41:45
合計ジャッジ時間 8,274 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int total = 0;
		for (int i = 0; i < n; i++) {
		    total += sc.nextInt();
		}
		int count = total / (n - 1);
		int turtle = (count - 2 * n) / 2;
		int bird = n - turtle;
		System.out.println(bird + " " + turtle);
   }
}

0