結果
問題 | No.48 ロボットの操縦 |
ユーザー |
![]() |
提出日時 | 2018-11-20 05:36:29 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 132 ms / 5,000 ms |
コード長 | 525 bytes |
コンパイル時間 | 1,993 ms |
コンパイル使用メモリ | 74,772 KB |
実行使用メモリ | 41,372 KB |
最終ジャッジ日時 | 2024-12-24 15:23:24 |
合計ジャッジ時間 | 5,762 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
ソースコード
import java.util.Scanner;public class Main{public static void main(String args[])throws Exception{Scanner sc = new Scanner(System.in);int X = sc.nextInt();int Y = sc.nextInt();int L = sc.nextInt();X = Math.abs(X);int ans = 0;if(Y>0){ans += (Y-1)/L+1;if(X>0){ans += (X-1)/L+2;}}else if(Y<0){ans += 2;Y = Math.abs(Y);if(X>0){ans += (X-1)/L+1;}ans += (Y-1)/L+1;}else{if(X>0){ans += (X-1)/L+2;}}System.out.println(ans);}}