結果

問題 No.48 ロボットの操縦
ユーザー papipenpapipen
提出日時 2017-03-27 23:14:53
言語 Java21
(openjdk 21)
結果
AC  
実行時間 130 ms / 5,000 ms
コード長 541 bytes
コンパイル時間 2,354 ms
コンパイル使用メモリ 71,984 KB
実行使用メモリ 56,200 KB
最終ジャッジ日時 2023-09-20 14:45:12
合計ジャッジ時間 6,509 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,764 KB
testcase_01 AC 125 ms
55,768 KB
testcase_02 AC 127 ms
55,800 KB
testcase_03 AC 127 ms
55,716 KB
testcase_04 AC 126 ms
55,952 KB
testcase_05 AC 128 ms
55,688 KB
testcase_06 AC 129 ms
55,724 KB
testcase_07 AC 128 ms
55,648 KB
testcase_08 AC 128 ms
55,760 KB
testcase_09 AC 127 ms
55,892 KB
testcase_10 AC 125 ms
55,400 KB
testcase_11 AC 128 ms
56,200 KB
testcase_12 AC 124 ms
55,724 KB
testcase_13 AC 127 ms
55,916 KB
testcase_14 AC 126 ms
55,648 KB
testcase_15 AC 127 ms
55,396 KB
testcase_16 AC 128 ms
55,716 KB
testcase_17 AC 127 ms
55,744 KB
testcase_18 AC 125 ms
55,604 KB
testcase_19 AC 125 ms
55,996 KB
testcase_20 AC 130 ms
55,476 KB
testcase_21 AC 127 ms
55,720 KB
testcase_22 AC 128 ms
55,648 KB
testcase_23 AC 125 ms
55,372 KB
testcase_24 AC 127 ms
55,752 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 != 0 && (x % L != 0 || Math.abs(x) < L)){
			xtime += 1;
		}
		if(y != 0 && (y % L != 0 || Math.abs(y) < L)){
			ytime += 1;
		}
		System.out.println(xtime + ytime + retur);
	}
}
0