結果
問題 | No.48 ロボットの操縦 |
ユーザー |
![]() |
提出日時 | 2014-12-21 17:55:47 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 126 ms / 5,000 ms |
コード長 | 525 bytes |
コンパイル時間 | 3,721 ms |
コンパイル使用メモリ | 74,492 KB |
実行使用メモリ | 41,764 KB |
最終ジャッジ日時 | 2024-11-21 18:14:48 |
合計ジャッジ時間 | 7,044 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
ソースコード
package benkyoukai;import java.util.Scanner;public class Robot {public static void main(String[] args) {int x, y, l;int ans=0;Scanner sc = new Scanner(System.in);x = sc.nextInt();y = sc.nextInt();l = sc.nextInt();x=Math.abs(x);if(y==0){if(x==0){ans = 0;}else{ans = (x + l -1)/l+1;}}if(y>0){ans = (y+l-1)/l;if(x!=0){ans +=1+(x+l-1)/l;}}if(y<0){ans = (-y+l-1)/l;if(x==0){ans +=2;}else{ans +=(2+(x+l-1)/l);}}System.out.println(ans);}}