結果

問題 No.112 ややこしい鶴亀算
ユーザー htensaihtensai
提出日時 2019-12-05 16:02:34
言語 Java21
(openjdk 21)
結果
AC  
実行時間 162 ms / 5,000 ms
コード長 372 bytes
コンパイル時間 2,893 ms
コンパイル使用メモリ 73,776 KB
実行使用メモリ 57,348 KB
最終ジャッジ日時 2023-08-22 22:08:40
合計ジャッジ時間 7,665 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 155 ms
56,676 KB
testcase_01 AC 156 ms
57,348 KB
testcase_02 AC 155 ms
56,776 KB
testcase_03 AC 153 ms
56,456 KB
testcase_04 AC 152 ms
56,728 KB
testcase_05 AC 154 ms
56,808 KB
testcase_06 AC 152 ms
56,748 KB
testcase_07 AC 155 ms
56,580 KB
testcase_08 AC 156 ms
57,096 KB
testcase_09 AC 154 ms
56,772 KB
testcase_10 AC 158 ms
56,628 KB
testcase_11 AC 154 ms
56,552 KB
testcase_12 AC 151 ms
57,088 KB
testcase_13 AC 156 ms
56,508 KB
testcase_14 AC 161 ms
56,552 KB
testcase_15 AC 162 ms
56,516 KB
testcase_16 AC 159 ms
56,692 KB
testcase_17 AC 162 ms
56,432 KB
testcase_18 AC 160 ms
56,776 KB
testcase_19 AC 159 ms
56,584 KB
testcase_20 AC 156 ms
56,836 KB
testcase_21 AC 157 ms
56,708 KB
testcase_22 AC 158 ms
56,856 KB
testcase_23 AC 162 ms
56,812 KB
testcase_24 AC 158 ms
56,992 KB
権限があれば一括ダウンロードができます

ソースコード

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