結果

問題 No.48 ロボットの操縦
ユーザー papipenpapipen
提出日時 2017-03-27 23:35:38
言語 Java21
(openjdk 21)
結果
AC  
実行時間 128 ms / 5,000 ms
コード長 479 bytes
コンパイル時間 2,841 ms
コンパイル使用メモリ 71,348 KB
実行使用メモリ 56,056 KB
最終ジャッジ日時 2023-09-20 14:51:44
合計ジャッジ時間 7,243 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,904 KB
testcase_01 AC 126 ms
55,492 KB
testcase_02 AC 126 ms
55,596 KB
testcase_03 AC 126 ms
55,816 KB
testcase_04 AC 128 ms
55,852 KB
testcase_05 AC 126 ms
55,680 KB
testcase_06 AC 126 ms
55,588 KB
testcase_07 AC 126 ms
55,592 KB
testcase_08 AC 127 ms
55,740 KB
testcase_09 AC 125 ms
55,992 KB
testcase_10 AC 124 ms
55,304 KB
testcase_11 AC 125 ms
55,936 KB
testcase_12 AC 125 ms
55,972 KB
testcase_13 AC 127 ms
56,056 KB
testcase_14 AC 127 ms
55,636 KB
testcase_15 AC 125 ms
55,596 KB
testcase_16 AC 125 ms
55,804 KB
testcase_17 AC 124 ms
55,660 KB
testcase_18 AC 125 ms
55,804 KB
testcase_19 AC 126 ms
55,732 KB
testcase_20 AC 126 ms
55,528 KB
testcase_21 AC 128 ms
55,256 KB
testcase_22 AC 125 ms
55,820 KB
testcase_23 AC 125 ms
55,864 KB
testcase_24 AC 127 ms
55,864 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
class robotto{
	public static void main(String args[]){
		Scanner s = new Scanner(System.in);
		int x = s.nextInt();
		int y = s.nextInt();
		int L = s.nextInt();
		int xtime = (int)Math.abs(x / L);
		int ytime = (int)Math.abs(y / L);
		int retur = 0;
		if(x != 0 && y >= 0){
			retur = 1;
		}else if(y < 0){
			retur = 2;
		}
		
		if(x % L != 0){
			xtime += 1;
		}
		if(y % L != 0){
			ytime += 1;
		}
		System.out.println(xtime + ytime + retur);
	}
}
0