結果

問題 No.48 ロボットの操縦
ユーザー 3pstn
提出日時 2014-12-21 17:31:35
言語 Java
(openjdk 23)
結果
AC  
実行時間 140 ms / 5,000 ms
コード長 632 bytes
コンパイル時間 2,460 ms
コンパイル使用メモリ 78,432 KB
実行使用メモリ 41,836 KB
最終ジャッジ日時 2024-11-21 18:14:38
合計ジャッジ時間 6,240 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    // 整数の入力
	int x = sc.nextInt();
	int y = sc.nextInt();
	double l = sc.nextInt();

	double countx = 0;
	double county = 0;
	int countturn = 0;

	countx = Math.ceil(Math.abs(x) / l);
	county = Math.ceil(Math.abs(y) / l);
	//System.out.println(countx);
	//System.out.println(county);

	if(y < 0) countturn = 2;
	else if(x == 0) countturn = 0;
	else countturn = 1;
	//System.out.println(countturn);

	int total = 0;
	total = (int)countx + (int)county + countturn;
	System.out.println(total);
  }
}
0