結果

問題 No.48 ロボットの操縦
ユーザー TwinkleStar74
提出日時 2017-09-18 15:06:22
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 782 bytes
コンパイル時間 3,158 ms
コンパイル使用メモリ 73,968 KB
実行使用メモリ 37,196 KB
最終ジャッジ日時 2024-11-08 02:32:12
合計ジャッジ時間 4,416 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17 WA * 8
権限があれば一括ダウンロードができます

ソースコード

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