結果

問題 No.48 ロボットの操縦
ユーザー Tsukasa_TypeTsukasa_Type
提出日時 2018-02-09 14:42:17
言語 Java21
(openjdk 21)
結果
AC  
実行時間 142 ms / 5,000 ms
コード長 408 bytes
コンパイル時間 2,816 ms
コンパイル使用メモリ 74,788 KB
実行使用メモリ 54,324 KB
最終ジャッジ日時 2024-04-16 06:05:05
合計ジャッジ時間 6,627 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 135 ms
54,012 KB
testcase_01 AC 138 ms
54,016 KB
testcase_02 AC 137 ms
53,916 KB
testcase_03 AC 139 ms
54,236 KB
testcase_04 AC 136 ms
53,656 KB
testcase_05 AC 138 ms
53,732 KB
testcase_06 AC 134 ms
54,276 KB
testcase_07 AC 138 ms
54,228 KB
testcase_08 AC 137 ms
54,132 KB
testcase_09 AC 137 ms
54,016 KB
testcase_10 AC 136 ms
54,080 KB
testcase_11 AC 137 ms
54,088 KB
testcase_12 AC 137 ms
53,840 KB
testcase_13 AC 138 ms
54,136 KB
testcase_14 AC 138 ms
53,688 KB
testcase_15 AC 137 ms
54,108 KB
testcase_16 AC 136 ms
54,176 KB
testcase_17 AC 138 ms
54,248 KB
testcase_18 AC 142 ms
54,276 KB
testcase_19 AC 138 ms
54,320 KB
testcase_20 AC 138 ms
53,908 KB
testcase_21 AC 142 ms
54,244 KB
testcase_22 AC 138 ms
54,324 KB
testcase_23 AC 137 ms
54,244 KB
testcase_24 AC 136 ms
54,132 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int x = sc.nextInt();
		int y = sc.nextInt();
		int leng = sc.nextInt();
		int times = (Math.abs(x)+leng-1)/leng + (Math.abs(y)+leng-1)/leng;
		if (y>=0 && x==0) {times += 0;}
		else if (y>=0 && x!=0) {times += 1;}
		else if (y<0) {times += 2;}
		System.out.println(times);
	}
}
0