結果

問題 No.48 ロボットの操縦
ユーザー shinwisteriashinwisteria
提出日時 2017-03-18 21:07:44
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 583 bytes
コンパイル時間 3,138 ms
コンパイル使用メモリ 71,636 KB
実行使用メモリ 56,316 KB
最終ジャッジ日時 2023-09-18 02:49:36
合計ジャッジ時間 7,411 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 119 ms
55,336 KB
testcase_02 WA -
testcase_03 AC 124 ms
55,840 KB
testcase_04 AC 123 ms
56,316 KB
testcase_05 WA -
testcase_06 AC 123 ms
56,068 KB
testcase_07 AC 121 ms
55,844 KB
testcase_08 AC 120 ms
55,664 KB
testcase_09 AC 120 ms
55,764 KB
testcase_10 AC 123 ms
56,012 KB
testcase_11 AC 122 ms
55,968 KB
testcase_12 AC 122 ms
55,772 KB
testcase_13 AC 123 ms
55,816 KB
testcase_14 AC 123 ms
55,744 KB
testcase_15 AC 121 ms
56,096 KB
testcase_16 AC 122 ms
55,784 KB
testcase_17 AC 122 ms
56,196 KB
testcase_18 AC 123 ms
55,976 KB
testcase_19 AC 122 ms
56,232 KB
testcase_20 AC 123 ms
55,712 KB
testcase_21 AC 124 ms
55,976 KB
testcase_22 AC 122 ms
54,192 KB
testcase_23 AC 124 ms
55,652 KB
testcase_24 AC 123 ms
55,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Robo {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int X = s.nextInt(), Y = s.nextInt(), L = s.nextInt(), count = 0;
		s.close();
		if(Y >= 0){
				count += COUNT(Y, L, count);
				count += COUNT(X,L,count) + 1;
		}else{
			if(X != 0){
				count += COUNT(X,L,count) + 1;
				count += COUNT(Y,L,count) + 1;
			}
			
		}
		System.out.println(count);

	}
	
	static int COUNT(int p,int k, int count){
		if(p%k == 0){
			count = Math.abs(p/k);
		}else{
			count = Math.abs(p/k) + 1;
		}
		return count;
	}

}
0