結果

問題 No.48 ロボットの操縦
ユーザー YukimotoPG
提出日時 2019-02-14 23:30:15
言語 Java
(openjdk 23)
結果
AC  
実行時間 133 ms / 5,000 ms
コード長 526 bytes
コンパイル時間 2,206 ms
コンパイル使用メモリ 74,172 KB
実行使用メモリ 54,352 KB
最終ジャッジ日時 2024-09-13 11:36:16
合計ジャッジ時間 6,347 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		
		int x = sc.nextInt(); int y = sc.nextInt(); int L = sc.nextInt();
		
		int ans = 0;
		
		if (y>=0 && x!=0) ans += 1;
		else if (y<0) ans += 2;
		
//		System.out.println(":"+ans);
		
		if (x%L == 0) ans += Math.abs(x/L);
		else ans += Math.abs(x/L) + 1;
		
//		System.out.println(":"+ans);
		
		if (y%L == 0) ans += Math.abs(y/L);
		else ans += Math.abs(y/L) + 1;
		
		System.out.println(ans);
		
	}
}
0