結果

問題 No.48 ロボットの操縦
ユーザー kuramukuramu
提出日時 2016-01-19 23:37:58
言語 Java21
(openjdk 21)
結果
AC  
実行時間 54 ms / 5,000 ms
コード長 883 bytes
コンパイル時間 2,956 ms
コンパイル使用メモリ 75,396 KB
実行使用メモリ 37,180 KB
最終ジャッジ日時 2024-05-01 13:47:36
合計ジャッジ時間 4,110 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
36,924 KB
testcase_01 AC 53 ms
37,036 KB
testcase_02 AC 54 ms
37,136 KB
testcase_03 AC 52 ms
37,060 KB
testcase_04 AC 51 ms
36,884 KB
testcase_05 AC 52 ms
37,040 KB
testcase_06 AC 52 ms
37,132 KB
testcase_07 AC 52 ms
36,880 KB
testcase_08 AC 53 ms
36,972 KB
testcase_09 AC 53 ms
36,960 KB
testcase_10 AC 52 ms
37,056 KB
testcase_11 AC 52 ms
37,120 KB
testcase_12 AC 53 ms
36,640 KB
testcase_13 AC 53 ms
37,080 KB
testcase_14 AC 52 ms
36,940 KB
testcase_15 AC 52 ms
37,100 KB
testcase_16 AC 53 ms
37,092 KB
testcase_17 AC 53 ms
36,916 KB
testcase_18 AC 53 ms
36,612 KB
testcase_19 AC 51 ms
37,180 KB
testcase_20 AC 51 ms
37,080 KB
testcase_21 AC 50 ms
36,840 KB
testcase_22 AC 52 ms
36,980 KB
testcase_23 AC 51 ms
36,840 KB
testcase_24 AC 51 ms
36,992 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Main {

	public static void main(String[] args) {
	      BufferedReader stdReader =new BufferedReader(new InputStreamReader(System.in));
	      String line = "";
	      int count=0;
	      try {
	    	  int X = Integer.parseInt(stdReader.readLine());
	    	  int Y = Integer.parseInt(stdReader.readLine());
	    	  int L = Integer.parseInt(stdReader.readLine());
	    	  if(X!=0) count++;
    		  count += Math.abs(X)/L;
	    	  if(Math.abs(X)%L!= 0) count++;
	    	  count += Math.abs(Y)/L;
	    	  if(Math.abs(Y)%L!=0) count++;
	    	  if(Y<0){
	    		  if(X !=0){
	    		  count++;
		    	  }else{
		    		  count += 2;
		    	  }
	    	  }
	    	  System.out.println(count);
	    	  } catch (IOException e) {
			e.printStackTrace();
	      }
	}
}
0