結果

問題 No.48 ロボットの操縦
ユーザー shinwisteriashinwisteria
提出日時 2017-03-18 21:05:31
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 547 bytes
コンパイル時間 3,188 ms
コンパイル使用メモリ 72,476 KB
実行使用メモリ 57,536 KB
最終ジャッジ日時 2023-09-18 02:49:56
合計ジャッジ時間 7,354 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
56,144 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 120 ms
55,844 KB
testcase_04 WA -
testcase_05 AC 122 ms
56,384 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 122 ms
56,468 KB
testcase_09 WA -
testcase_10 AC 121 ms
56,088 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 122 ms
56,440 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 127 ms
56,044 KB
testcase_23 WA -
testcase_24 AC 123 ms
56,064 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);
		}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