結果
問題 | No.48 ロボットの操縦 |
ユーザー |
|
提出日時 | 2018-04-09 23:14:18 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 137 ms / 5,000 ms |
コード長 | 648 bytes |
コンパイル時間 | 1,971 ms |
コンパイル使用メモリ | 74,132 KB |
実行使用メモリ | 54,240 KB |
最終ジャッジ日時 | 2024-06-26 20:50:32 |
合計ジャッジ時間 | 6,174 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
ソースコード
import java.util.Scanner; class No48 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int X = sc.nextInt(); int Y = sc.nextInt(); int L = sc.nextInt(); int changeInDirection = 0; if (X > 0 || X < 0) { changeInDirection++; if (Y < 0) { changeInDirection++; } } else if (Y < 0) { changeInDirection++; changeInDirection++; } changeInDirection += (Math.abs(X)) / L; if (!(Math.abs(X) % L == 0)) { changeInDirection++; } changeInDirection += (Math.abs(Y)) / L; if (!(Math.abs(Y) % L == 0)) { changeInDirection++; } System.out.println(changeInDirection); } }