結果

問題 No.48 ロボットの操縦
ユーザー scachescache
提出日時 2014-11-30 23:42:21
言語 Java21
(openjdk 21)
結果
AC  
実行時間 125 ms / 5,000 ms
コード長 530 bytes
コンパイル時間 4,232 ms
コンパイル使用メモリ 73,192 KB
実行使用メモリ 56,248 KB
最終ジャッジ日時 2023-08-14 00:00:19
合計ジャッジ時間 8,657 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,864 KB
testcase_01 AC 115 ms
56,112 KB
testcase_02 AC 113 ms
55,904 KB
testcase_03 AC 114 ms
56,096 KB
testcase_04 AC 112 ms
55,656 KB
testcase_05 AC 116 ms
55,372 KB
testcase_06 AC 117 ms
55,976 KB
testcase_07 AC 120 ms
56,212 KB
testcase_08 AC 112 ms
56,016 KB
testcase_09 AC 111 ms
56,076 KB
testcase_10 AC 110 ms
55,876 KB
testcase_11 AC 119 ms
55,548 KB
testcase_12 AC 113 ms
56,016 KB
testcase_13 AC 115 ms
55,868 KB
testcase_14 AC 111 ms
55,880 KB
testcase_15 AC 113 ms
55,764 KB
testcase_16 AC 112 ms
56,024 KB
testcase_17 AC 112 ms
56,184 KB
testcase_18 AC 113 ms
56,248 KB
testcase_19 AC 117 ms
56,024 KB
testcase_20 AC 119 ms
55,868 KB
testcase_21 AC 117 ms
55,892 KB
testcase_22 AC 117 ms
55,884 KB
testcase_23 AC 117 ms
55,796 KB
testcase_24 AC 117 ms
55,868 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main48 {
	public static void main(String[] args) {
		Main48 p = new Main48();
	}

	public Main48() {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		int l = sc.nextInt();
		solve(x, y, l);
	}

	public void solve(int x, int y, int l) {
		int res = x!=0 ? (Math.abs(x)-1)/l + 1 : 0;
		res += y!=0 ? (Math.abs(y)-1)/l + 1 : 0;
		
		if(y<0)
			res+=2;
		else if(Math.abs(x)>0)
			res++;
		
		System.out.println(res);
	}

}
0