結果
問題 |
No.112 ややこしい鶴亀算
|
ユーザー |
![]() |
提出日時 | 2018-07-12 03:52:54 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 128 ms / 5,000 ms |
コード長 | 668 bytes |
コンパイル時間 | 2,559 ms |
コンパイル使用メモリ | 75,352 KB |
実行使用メモリ | 54,168 KB |
最終ジャッジ日時 | 2024-09-22 15:11:34 |
合計ジャッジ時間 | 6,363 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 23 |
ソースコード
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); } }