結果

問題 No.112 ややこしい鶴亀算
コンテスト
ユーザー nkhrlab
提出日時 2018-07-12 03:52:54
言語 Java
(openjdk 25.0.2)
コンパイル:
javac -encoding UTF8 _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true _class_
結果
AC  
実行時間 52 ms / 5,000 ms
コード長 668 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,697 ms
コンパイル使用メモリ 82,092 KB
実行使用メモリ 46,620 KB
最終ジャッジ日時 2026-04-10 21:28:43
合計ジャッジ時間 4,311 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main
{

  public static void main(String[] args) throws IOException
  {
    BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);
    String s = r.readLine();
    int n = Integer.parseInt(s);
    int a[] = new int[100];
    s = r.readLine();
    String[] sl = s.split(" ");

    for(int i = 0; i < n; i++)
    {
      a[i] = Integer.parseInt(sl[i]);
    }
    
    int k = 0;
    
    for(int i = 0; i < n; i++)
    {
      k += a[i];
    }
    k /= n - 1;
    
    System.out.printf("%d %d", (4 * n - k) / 2, n - (4 * n - k) / 2);

  }

}
0