結果
問題 | No.48 ロボットの操縦 |
ユーザー |
|
提出日時 | 2018-05-15 01:13:02 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 143 ms / 5,000 ms |
コード長 | 749 bytes |
コンパイル時間 | 4,136 ms |
コンパイル使用メモリ | 74,580 KB |
実行使用メモリ | 41,516 KB |
最終ジャッジ日時 | 2024-06-28 12:00:20 |
合計ジャッジ時間 | 8,534 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
ソースコード
import java.util.Scanner;import java.util.regex.Matcher;import java.util.regex.Pattern;public class RobotOperation{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 num_step = 0;if(X != 0 && Y >= 0){num_step += 1;}else if(Y < 0){num_step += 2;}if(X%L == 0){num_step += Math.abs(X)/L;}else{num_step += Math.abs(X)/L+1;}if(Y%L == 0){num_step += Math.abs(Y)/L;}else{num_step += Math.abs(Y)/L+1;}System.out.println(num_step);}}