結果

問題 No.48 ロボットの操縦
ユーザー kuramukuramu
提出日時 2016-01-19 23:37:58
言語 Java21
(openjdk 21)
結果
AC  
実行時間 45 ms / 5,000 ms
コード長 883 bytes
コンパイル時間 2,020 ms
コンパイル使用メモリ 71,644 KB
実行使用メモリ 49,868 KB
最終ジャッジ日時 2023-08-14 00:20:19
合計ジャッジ時間 4,248 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
49,488 KB
testcase_01 AC 43 ms
47,724 KB
testcase_02 AC 44 ms
49,200 KB
testcase_03 AC 44 ms
49,672 KB
testcase_04 AC 44 ms
49,116 KB
testcase_05 AC 45 ms
49,524 KB
testcase_06 AC 44 ms
49,160 KB
testcase_07 AC 44 ms
49,080 KB
testcase_08 AC 44 ms
49,160 KB
testcase_09 AC 43 ms
49,080 KB
testcase_10 AC 44 ms
49,428 KB
testcase_11 AC 43 ms
49,276 KB
testcase_12 AC 44 ms
49,304 KB
testcase_13 AC 44 ms
49,868 KB
testcase_14 AC 44 ms
49,152 KB
testcase_15 AC 44 ms
49,052 KB
testcase_16 AC 43 ms
49,304 KB
testcase_17 AC 44 ms
49,424 KB
testcase_18 AC 43 ms
49,184 KB
testcase_19 AC 44 ms
49,192 KB
testcase_20 AC 44 ms
49,132 KB
testcase_21 AC 44 ms
49,244 KB
testcase_22 AC 44 ms
49,256 KB
testcase_23 AC 44 ms
49,372 KB
testcase_24 AC 44 ms
49,236 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