結果
問題 | No.48 ロボットの操縦 |
ユーザー |
![]() |
提出日時 | 2016-05-14 15:12:52 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 120 ms / 5,000 ms |
コード長 | 1,248 bytes |
コンパイル時間 | 2,128 ms |
コンパイル使用メモリ | 77,412 KB |
実行使用メモリ | 41,164 KB |
最終ジャッジ日時 | 2024-11-21 18:39:33 |
合計ジャッジ時間 | 5,891 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
ソースコード
import java.util.Scanner;public class Main {public static void main(String[] args) {try (Scanner scan = new Scanner(System.in)) {int x = Integer.parseInt(scan.next());int y = Integer.parseInt(scan.next());int l = Integer.parseInt(scan.next());int count = 0;if(y >= 0) {x = Math.abs(x);y = Math.abs(y);count += (y / l);if(y%l > 0) count++;if(x != 0) {count++;count += (x / l);if(x%l > 0) count++;}} else if(y < 0) {x = Math.abs(x);y = Math.abs(y);if(x == 0) {count+=2;count += (y / l);if(y%l > 0) count++;} else if(x > 0) {count++;count += (x / l);if(x%l > 0) count++;count++;count += (y / l);if(y%l > 0) count++;}}System.out.println(count);}}}