結果

問題 No.112 ややこしい鶴亀算
ユーザー chiho_miyakochiho_miyako
提出日時 2015-04-07 12:20:39
言語 Java21
(openjdk 21)
結果
AC  
実行時間 135 ms / 5,000 ms
コード長 541 bytes
コンパイル時間 2,096 ms
コンパイル使用メモリ 71,696 KB
実行使用メモリ 56,324 KB
最終ジャッジ日時 2023-09-17 06:36:35
合計ジャッジ時間 6,449 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
56,100 KB
testcase_01 AC 127 ms
55,984 KB
testcase_02 AC 125 ms
56,180 KB
testcase_03 AC 128 ms
55,772 KB
testcase_04 AC 127 ms
53,864 KB
testcase_05 AC 125 ms
55,772 KB
testcase_06 AC 126 ms
55,984 KB
testcase_07 AC 126 ms
55,720 KB
testcase_08 AC 125 ms
56,088 KB
testcase_09 AC 125 ms
56,152 KB
testcase_10 AC 126 ms
56,172 KB
testcase_11 AC 126 ms
56,152 KB
testcase_12 AC 123 ms
55,584 KB
testcase_13 AC 124 ms
55,760 KB
testcase_14 AC 127 ms
53,872 KB
testcase_15 AC 131 ms
55,656 KB
testcase_16 AC 132 ms
56,324 KB
testcase_17 AC 132 ms
55,644 KB
testcase_18 AC 131 ms
55,916 KB
testcase_19 AC 130 ms
55,800 KB
testcase_20 AC 135 ms
55,904 KB
testcase_21 AC 132 ms
55,876 KB
testcase_22 AC 131 ms
55,952 KB
testcase_23 AC 133 ms
55,764 KB
testcase_24 AC 134 ms
55,728 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner koko = new Scanner(System.in);
        int n = koko.nextInt();
        int[] a = new int[n];
        int sum = 0;
        for(int i=0; i<n; i++){
            a[i] = koko.nextInt();
            sum = sum + a[i];
        }
        int sumt = sum/(n-1);
        int turu = (4*n-sumt)/2;
        int kame = (sumt-2*n)/2;
        System.out.print(turu);
        System.out.print(" ");
        System.out.println(kame);
    }
}
0