結果

問題 No.48 ロボットの操縦
ユーザー TwinkleStar74TwinkleStar74
提出日時 2017-09-18 15:06:22
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 782 bytes
コンパイル時間 2,245 ms
コンパイル使用メモリ 75,176 KB
実行使用メモリ 51,928 KB
最終ジャッジ日時 2024-04-25 15:29:27
合計ジャッジ時間 4,420 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
50,404 KB
testcase_01 AC 53 ms
50,248 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 54 ms
50,316 KB
testcase_05 AC 54 ms
50,164 KB
testcase_06 WA -
testcase_07 AC 54 ms
50,032 KB
testcase_08 WA -
testcase_09 AC 54 ms
50,300 KB
testcase_10 WA -
testcase_11 AC 56 ms
50,264 KB
testcase_12 AC 55 ms
50,380 KB
testcase_13 AC 54 ms
50,052 KB
testcase_14 AC 54 ms
50,112 KB
testcase_15 AC 55 ms
49,952 KB
testcase_16 AC 54 ms
50,328 KB
testcase_17 AC 54 ms
50,356 KB
testcase_18 WA -
testcase_19 AC 56 ms
50,244 KB
testcase_20 AC 55 ms
50,088 KB
testcase_21 AC 55 ms
50,324 KB
testcase_22 WA -
testcase_23 AC 53 ms
50,304 KB
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class No48 {

	public static void main(String[] args) throws IOException, NumberFormatException{
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int touzai = Integer.parseInt(br.readLine());
		int nanboku = Integer.parseInt(br.readLine());
		int zenshin = Integer.parseInt(br.readLine());
		
		int x = Calculation.calc(touzai,zenshin);
		int y = Calculation.calc(nanboku,zenshin);
		
		if (touzai != 0 && nanboku != 0) System.out.println(x+y+1);
		else System.out.println(x+y);
		
	}
	
	public static class Calculation{
		public static int calc(int x, int y){
			if (Math.abs(x)%y == 0) return (Math.abs(x)/y);
			else return (Math.abs(x)/y) + 1;
		}
	}
}
0