結果
問題 | No.112 ややこしい鶴亀算 |
ユーザー |
|
提出日時 | 2016-05-05 11:07:19 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 145 ms / 5,000 ms |
コード長 | 673 bytes |
コンパイル時間 | 1,970 ms |
コンパイル使用メモリ | 77,884 KB |
実行使用メモリ | 55,004 KB |
最終ジャッジ日時 | 2024-10-05 09:29:30 |
合計ジャッジ時間 | 6,347 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 23 |
ソースコード
package jp.fedom.challange.yuki.q112; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); List<String> input = new ArrayList<>(); while (sc.hasNext()) { input.add(sc.nextLine()); } System.out.println(solve(input)); sc.close(); } public static String solve(List<String> in) { int N = Integer.valueOf(in.get(0).split(" ")[0]); int t = 0; for (String s : in.get(1).split(" ")) { t += Integer.valueOf(s); } int kame = (t - ((N - 1) * N * 2)) / (2 * (N - 1)); int tsuru = N - kame; return tsuru + " " + kame; } }