結果
問題 | No.149 碁石の移動 |
ユーザー |
|
提出日時 | 2016-05-05 11:51:43 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 126 ms / 2,000 ms |
コード長 | 942 bytes |
コンパイル時間 | 2,289 ms |
コンパイル使用メモリ | 79,060 KB |
実行使用メモリ | 41,172 KB |
最終ジャッジ日時 | 2024-12-24 03:16:52 |
合計ジャッジ時間 | 5,098 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 13 |
ソースコード
package jp.fedom.challange.yuki.q149; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Main { final static String d = System.getProperty("line.separator"); 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 int solve(List<String> in) { Integer Aw = Integer.valueOf(in.get(0).split(" ")[0]); Integer Ab = Integer.valueOf(in.get(0).split(" ")[1]); Integer Bw = Integer.valueOf(in.get(1).split(" ")[0]); Integer Bb = Integer.valueOf(in.get(1).split(" ")[1]); Integer C = Integer.valueOf(in.get(2).split(" ")[0]); Integer D = Integer.valueOf(in.get(2).split(" ")[1]); int mo = Math.min(Ab, C); Bw += C - mo; Aw -= C - mo; mo = Math.min(Bw, D); Aw += mo; return Aw; } }