結果
問題 | No.48 ロボットの操縦 |
ユーザー |
![]() |
提出日時 | 2016-02-01 20:45:31 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 129 ms / 5,000 ms |
コード長 | 463 bytes |
コンパイル時間 | 2,607 ms |
コンパイル使用メモリ | 74,096 KB |
実行使用メモリ | 41,472 KB |
最終ジャッジ日時 | 2024-11-21 18:34:09 |
合計ジャッジ時間 | 5,794 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
ソースコード
import java.util.*;import java.math.*;import java.io.*;public class Main {public static void main(String[] args) {Scanner sc = new Scanner(System.in);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 || x != 0) ans += 2;ans += Math.abs((y / l)) + (y % l != 0 && y != 0?1:0);ans += Math.abs((x / l)) + (x % l != 0 && x != 0?1:0);System.out.println(ans);}}