結果

問題 No.48 ロボットの操縦
ユーザー scachescache
提出日時 2014-11-30 23:42:21
言語 Java21
(openjdk 21)
結果
AC  
実行時間 136 ms / 5,000 ms
コード長 530 bytes
コンパイル時間 4,063 ms
コンパイル使用メモリ 78,940 KB
実行使用メモリ 41,652 KB
最終ジャッジ日時 2024-05-01 13:31:35
合計ジャッジ時間 7,723 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
39,976 KB
testcase_01 AC 134 ms
41,332 KB
testcase_02 AC 133 ms
41,196 KB
testcase_03 AC 133 ms
41,196 KB
testcase_04 AC 129 ms
41,160 KB
testcase_05 AC 131 ms
40,908 KB
testcase_06 AC 131 ms
41,652 KB
testcase_07 AC 131 ms
40,980 KB
testcase_08 AC 131 ms
41,328 KB
testcase_09 AC 133 ms
41,412 KB
testcase_10 AC 130 ms
41,076 KB
testcase_11 AC 132 ms
41,108 KB
testcase_12 AC 119 ms
39,880 KB
testcase_13 AC 136 ms
41,464 KB
testcase_14 AC 133 ms
41,340 KB
testcase_15 AC 133 ms
41,116 KB
testcase_16 AC 131 ms
41,204 KB
testcase_17 AC 134 ms
41,256 KB
testcase_18 AC 135 ms
41,168 KB
testcase_19 AC 132 ms
41,020 KB
testcase_20 AC 135 ms
41,188 KB
testcase_21 AC 135 ms
41,284 KB
testcase_22 AC 123 ms
40,296 KB
testcase_23 AC 132 ms
41,380 KB
testcase_24 AC 129 ms
41,088 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