結果

問題 No.48 ロボットの操縦
ユーザー takutaku
提出日時 2020-10-06 16:08:58
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 983 bytes
コンパイル時間 3,554 ms
コンパイル使用メモリ 74,544 KB
実行使用メモリ 54,396 KB
最終ジャッジ日時 2024-07-20 02:06:19
合計ジャッジ時間 7,135 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        
        Scanner sc = new Scanner(System.in);
        int x = Integer.parseInt(sc.nextLine());
        int y = Integer.parseInt(sc.nextLine());
        int l = Integer.parseInt(sc.nextLine());
        
        int count = 0;
        int dis = 0;
        // 向きの変更回数
        if(y > 0 && x != 0) {
            count++;
        }else if(y < 0) {
            count += 2;
        }
        
        if(y % l != 0) {
            dis = y / l + 1;
            count += dis;
        }else {
            dis = y / l;
            count += dis;
            
        }
        
        if(x < 0) {
            x = -x;
        }
        
        if(x % l != 0) {
            dis = x / l + 1;
           count += dis;
        }else {
            dis = x / l;
            count += dis;
        }
        
        System.out.println(count);
    }
}
0