結果

問題 No.48 ロボットの操縦
ユーザー springspring
提出日時 2019-06-12 17:37:40
言語 Java21
(openjdk 21)
結果
AC  
実行時間 133 ms / 5,000 ms
コード長 496 bytes
コンパイル時間 2,106 ms
コンパイル使用メモリ 74,624 KB
実行使用メモリ 54,440 KB
最終ジャッジ日時 2024-04-19 08:45:01
合計ジャッジ時間 6,234 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
53,984 KB
testcase_01 AC 129 ms
54,420 KB
testcase_02 AC 129 ms
54,016 KB
testcase_03 AC 128 ms
53,876 KB
testcase_04 AC 127 ms
54,040 KB
testcase_05 AC 115 ms
52,716 KB
testcase_06 AC 128 ms
54,220 KB
testcase_07 AC 125 ms
54,168 KB
testcase_08 AC 133 ms
53,956 KB
testcase_09 AC 129 ms
53,960 KB
testcase_10 AC 115 ms
52,844 KB
testcase_11 AC 127 ms
54,176 KB
testcase_12 AC 128 ms
54,224 KB
testcase_13 AC 130 ms
54,020 KB
testcase_14 AC 127 ms
54,152 KB
testcase_15 AC 130 ms
54,212 KB
testcase_16 AC 131 ms
54,440 KB
testcase_17 AC 132 ms
54,384 KB
testcase_18 AC 128 ms
53,952 KB
testcase_19 AC 119 ms
53,096 KB
testcase_20 AC 126 ms
54,228 KB
testcase_21 AC 119 ms
52,944 KB
testcase_22 AC 130 ms
54,428 KB
testcase_23 AC 130 ms
54,176 KB
testcase_24 AC 114 ms
52,976 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int Y = sc.nextInt();
		int L = sc.nextInt();
		sc.close();
		int xStep = Math.abs(X)/L;
		int yStep = Math.abs(Y)/L;
		if(X%L!=0){
			xStep++;
		}
		if(Y%L!=0){
			yStep++;
		}
		int total = yStep + xStep;
		if(Y<0){
			total += 2;
		}else if(Y>=0&&X==0){

		}else{
			total += 1;
		}
		System.out.println(total);
	}// mainmethod

} // class
0