結果
問題 | No.48 ロボットの操縦 |
ユーザー | shinwisteria |
提出日時 | 2017-03-18 21:18:49 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 133 ms / 5,000 ms |
コード長 | 594 bytes |
コンパイル時間 | 3,646 ms |
コンパイル使用メモリ | 74,720 KB |
実行使用メモリ | 41,396 KB |
最終ジャッジ日時 | 2024-07-04 19:33:53 |
合計ジャッジ時間 | 7,258 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
ソースコード
import java.util.Scanner; public class Robo { public static void main(String[] args) { Scanner s = new Scanner(System.in); int X = s.nextInt(), Y = s.nextInt(), L = s.nextInt(), count = 0; s.close(); if(Y >= 0){ count += COUNT(Y, L); if(X != 0){ count += COUNT(X,L) + 1; } }else{ count += 2; if(X == 0){ count += COUNT(Y,L); }else{ count += COUNT(X,L); count += COUNT(Y,L); } } System.out.println(count); } static int COUNT(int p,int k){ if(p%k == 0){ return Math.abs(p/k); }else{ return Math.abs(p/k) + 1; } } }