結果

問題 No.48 ロボットの操縦
ユーザー shinwisteriashinwisteria
提出日時 2017-03-18 20:59:13
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 552 bytes
コンパイル時間 3,168 ms
コンパイル使用メモリ 71,708 KB
実行使用メモリ 57,832 KB
最終ジャッジ日時 2023-09-18 02:49:24
合計ジャッジ時間 7,622 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
57,832 KB
testcase_01 AC 120 ms
55,740 KB
testcase_02 AC 121 ms
55,864 KB
testcase_03 WA -
testcase_04 AC 122 ms
56,160 KB
testcase_05 AC 124 ms
56,576 KB
testcase_06 AC 122 ms
56,128 KB
testcase_07 AC 123 ms
56,100 KB
testcase_08 WA -
testcase_09 AC 128 ms
55,896 KB
testcase_10 WA -
testcase_11 AC 125 ms
56,260 KB
testcase_12 AC 123 ms
55,824 KB
testcase_13 AC 124 ms
53,744 KB
testcase_14 AC 124 ms
55,836 KB
testcase_15 AC 123 ms
55,828 KB
testcase_16 AC 124 ms
55,740 KB
testcase_17 AC 125 ms
55,836 KB
testcase_18 WA -
testcase_19 AC 123 ms
55,960 KB
testcase_20 AC 123 ms
55,972 KB
testcase_21 AC 124 ms
56,300 KB
testcase_22 WA -
testcase_23 AC 123 ms
56,260 KB
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

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);
		}else{
			count += 2;
			count += COUNT(Y,L,count);
			
		}
		if(X != 0)
			count += COUNT(X,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