結果

問題 No.112 ややこしい鶴亀算
ユーザー atkrymatkrym
提出日時 2016-10-25 21:34:10
言語 Java21
(openjdk 21)
結果
AC  
実行時間 165 ms / 5,000 ms
コード長 434 bytes
コンパイル時間 2,667 ms
コンパイル使用メモリ 73,740 KB
実行使用メモリ 56,956 KB
最終ジャッジ日時 2023-08-15 19:16:14
合計ジャッジ時間 7,369 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 151 ms
56,624 KB
testcase_01 AC 153 ms
56,544 KB
testcase_02 AC 152 ms
56,500 KB
testcase_03 AC 151 ms
56,716 KB
testcase_04 AC 151 ms
56,668 KB
testcase_05 AC 152 ms
56,640 KB
testcase_06 AC 159 ms
56,652 KB
testcase_07 AC 151 ms
56,468 KB
testcase_08 AC 151 ms
56,772 KB
testcase_09 AC 152 ms
56,504 KB
testcase_10 AC 153 ms
56,772 KB
testcase_11 AC 152 ms
56,756 KB
testcase_12 AC 152 ms
56,956 KB
testcase_13 AC 152 ms
56,768 KB
testcase_14 AC 158 ms
56,504 KB
testcase_15 AC 158 ms
56,696 KB
testcase_16 AC 158 ms
56,704 KB
testcase_17 AC 164 ms
56,640 KB
testcase_18 AC 159 ms
56,680 KB
testcase_19 AC 158 ms
56,728 KB
testcase_20 AC 165 ms
56,632 KB
testcase_21 AC 159 ms
56,416 KB
testcase_22 AC 159 ms
56,584 KB
testcase_23 AC 160 ms
56,728 KB
testcase_24 AC 163 ms
56,588 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    private static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
        int n = sc.nextInt();
        int sum = 0;
        for (int i = 0;i < n;i++) {
            sum += sc.nextInt();
        }
        sum /= n-1;
        int d = (sum-2*n)/2;
        int t = n - d;
        int k = d;
        
        System.out.println(t+" "+k);
    }
}
0