結果
問題 | No.48 ロボットの操縦 |
ユーザー |
|
提出日時 | 2018-01-07 17:22:19 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 146 ms / 5,000 ms |
コード長 | 586 bytes |
コンパイル時間 | 3,650 ms |
コンパイル使用メモリ | 74,820 KB |
実行使用メモリ | 41,744 KB |
最終ジャッジ日時 | 2024-12-23 10:10:22 |
合計ジャッジ時間 | 8,323 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
ソースコード
import java.util.Scanner;public class No0048 {public static void main(String[] args) {Scanner sc = new Scanner(System.in);int X = sc.nextInt();int Y = sc.nextInt();int L = sc.nextInt();System.out.println(turnCount(X, Y) + aheadCount(X, Y, L));}static int turnCount(int x, int y) {if (y >= 0) {if (x == 0) {return 0;}return 1;} else {return 2;}}static int aheadCount(int x, int y, int l) {int cnt = (Math.abs(x) / l) + (Math.abs(y) / l);if (x % l != 0) {cnt++;}if (y % l != 0) {cnt++;}return cnt;}}