結果

問題 No.48 ロボットの操縦
ユーザー shinwisteriashinwisteria
提出日時 2017-03-18 21:09:40
言語 Java19
(openjdk 21)
結果
WA  
実行時間 -
コード長 606 bytes
コンパイル時間 3,423 ms
コンパイル使用メモリ 71,804 KB
実行使用メモリ 56,476 KB
最終ジャッジ日時 2023-09-18 02:50:24
合計ジャッジ時間 7,482 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
55,704 KB
testcase_01 AC 124 ms
56,204 KB
testcase_02 WA -
testcase_03 AC 123 ms
56,476 KB
testcase_04 AC 123 ms
55,916 KB
testcase_05 AC 122 ms
55,648 KB
testcase_06 AC 123 ms
56,188 KB
testcase_07 AC 123 ms
55,820 KB
testcase_08 AC 122 ms
55,824 KB
testcase_09 AC 123 ms
55,772 KB
testcase_10 AC 123 ms
55,780 KB
testcase_11 AC 123 ms
55,988 KB
testcase_12 AC 125 ms
55,908 KB
testcase_13 AC 123 ms
56,016 KB
testcase_14 AC 123 ms
55,988 KB
testcase_15 AC 122 ms
56,072 KB
testcase_16 AC 122 ms
55,908 KB
testcase_17 AC 121 ms
55,600 KB
testcase_18 AC 123 ms
56,116 KB
testcase_19 AC 122 ms
55,684 KB
testcase_20 AC 125 ms
55,820 KB
testcase_21 AC 126 ms
56,384 KB
testcase_22 AC 121 ms
55,688 KB
testcase_23 AC 122 ms
55,716 KB
testcase_24 AC 121 ms
55,628 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);
				if(X != 0){
					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