結果

問題 No.48 ロボットの操縦
ユーザー kuramu
提出日時 2016-01-19 23:37:58
言語 Java
(openjdk 23)
結果
AC  
実行時間 51 ms / 5,000 ms
コード長 883 bytes
コンパイル時間 1,977 ms
コンパイル使用メモリ 74,360 KB
実行使用メモリ 48,236 KB
最終ジャッジ日時 2024-11-21 18:32:52
合計ジャッジ時間 3,997 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

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