結果
問題 | No.126 2基のエレベータ |
ユーザー |
|
提出日時 | 2015-12-21 23:21:17 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,667 bytes |
コンパイル時間 | 4,006 ms |
コンパイル使用メモリ | 79,328 KB |
実行使用メモリ | 53,944 KB |
最終ジャッジ日時 | 2023-10-18 22:09:59 |
合計ジャッジ時間 | 6,617 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | AC | 56 ms
53,820 KB |
testcase_02 | AC | 57 ms
53,812 KB |
testcase_03 | AC | 57 ms
53,816 KB |
testcase_04 | AC | 55 ms
53,816 KB |
testcase_05 | AC | 56 ms
53,820 KB |
testcase_06 | AC | 55 ms
52,876 KB |
testcase_07 | AC | 54 ms
53,820 KB |
testcase_08 | AC | 55 ms
52,844 KB |
testcase_09 | AC | 57 ms
53,832 KB |
testcase_10 | AC | 56 ms
53,812 KB |
testcase_11 | AC | 56 ms
53,848 KB |
testcase_12 | AC | 56 ms
51,888 KB |
testcase_13 | AC | 56 ms
53,812 KB |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | AC | 56 ms
53,816 KB |
testcase_19 | AC | 56 ms
53,820 KB |
testcase_20 | WA | - |
testcase_21 | AC | 55 ms
53,812 KB |
testcase_22 | AC | 55 ms
53,820 KB |
testcase_23 | AC | 55 ms
53,820 KB |
testcase_24 | AC | 56 ms
53,812 KB |
testcase_25 | AC | 55 ms
52,848 KB |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
ソースコード
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.Iterator; public class Main_yukicoder126 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); Printer pr = new Printer(System.out); int a = sc.nextInt(); int b = sc.nextInt(); int s = sc.nextInt(); pr.println(Math.min(Math.abs(a - s) + s, Math.abs(b - s) + s - 1 + Math.abs(a - 1) + 1)); pr.close(); sc.close(); } @SuppressWarnings("unused") private static class Scanner { BufferedReader br; Iterator<String> it; Scanner (InputStream in) { br = new BufferedReader(new InputStreamReader(in)); } String next() throws RuntimeException { try { if (it == null || !it.hasNext()) { it = Arrays.asList(br.readLine().split(" ")).iterator(); } return it.next(); } catch (IOException e) { throw new IllegalStateException(); } } int nextInt() throws RuntimeException { return Integer.parseInt(next()); } long nextLong() throws RuntimeException { return Long.parseLong(next()); } float nextFloat() throws RuntimeException { return Float.parseFloat(next()); } double nextDouble() throws RuntimeException { return Double.parseDouble(next()); } void close() { try { br.close(); } catch (IOException e) { // throw new IllegalStateException(); } } } private static class Printer extends PrintWriter { Printer(PrintStream out) { super(out); } } }