結果

問題 No.48 ロボットの操縦
ユーザー aaaaasatoriaaaaasatori
提出日時 2018-02-05 11:51:07
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 607 bytes
コンパイル時間 3,280 ms
コンパイル使用メモリ 72,960 KB
実行使用メモリ 56,364 KB
最終ジャッジ日時 2023-09-21 03:54:23
合計ジャッジ時間 7,906 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
55,888 KB
testcase_01 AC 125 ms
55,776 KB
testcase_02 WA -
testcase_03 AC 124 ms
55,808 KB
testcase_04 AC 126 ms
55,712 KB
testcase_05 AC 126 ms
56,032 KB
testcase_06 AC 126 ms
56,124 KB
testcase_07 AC 127 ms
55,836 KB
testcase_08 AC 128 ms
54,108 KB
testcase_09 AC 127 ms
54,116 KB
testcase_10 AC 126 ms
55,764 KB
testcase_11 AC 126 ms
56,124 KB
testcase_12 AC 127 ms
55,820 KB
testcase_13 AC 125 ms
55,796 KB
testcase_14 AC 126 ms
55,792 KB
testcase_15 AC 128 ms
55,664 KB
testcase_16 AC 126 ms
55,728 KB
testcase_17 AC 124 ms
55,832 KB
testcase_18 AC 126 ms
55,760 KB
testcase_19 AC 124 ms
55,916 KB
testcase_20 AC 123 ms
55,512 KB
testcase_21 AC 124 ms
55,828 KB
testcase_22 AC 125 ms
55,836 KB
testcase_23 AC 124 ms
55,948 KB
testcase_24 AC 128 ms
56,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class No48 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt(); //x座標
		int Y = sc.nextInt(); //y座標
		int L = sc.nextInt(); //一度に動ける距離
		int count = 0; //命令した回数
		
		if(X % L == 0) {
			count += Math.abs(X) / L;
		}else {
			count += Math.abs(X) / L + 1;
		}
		
		if(Y % L == 0) {
			count += Math.abs(Y) / L;
		}else {
			count += Math.abs(Y) / L + 1;
		}
		
		if(X != 0 && Y >= 0) {
			count++;
		}else if(Y < 0 && X != 0) {
			count += 2;
		}
		
		System.out.println(count);
	}
}
0