結果
問題 |
No.48 ロボットの操縦
|
ユーザー |
![]() |
提出日時 | 2016-02-05 17:53:17 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 733 bytes |
コンパイル時間 | 1,814 ms |
コンパイル使用メモリ | 73,788 KB |
実行使用メモリ | 41,280 KB |
最終ジャッジ日時 | 2024-09-21 20:37:37 |
合計ジャッジ時間 | 5,482 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 4 WA * 21 |
ソースコード
import java.util.Scanner; class Test { public static int corner(int x, int y, int l) { if(x / l == 0) { if(y / l == 0) { return x / l + y / l; } else { return x / l + y / l + 1; } } else { if(y / l == 0) { return x / l + y / l + 1; } else { return x / l + y / l + 2; } } } public static void main(String[] args) throws Exception { Scanner in = new Scanner(System.in); int x = in.nextInt(); int y = in.nextInt(); int l = in.nextInt(); int temp1 = x / l; int temp2 = y / l; int ans = 0; if(y >= 0) { if(x == 0) { ans = corner(x,y,l); } else { ans = corner(x,y,l) + 1; } } else if(y < 0) { ans = corner(x,y,l) + 2; } System.out.println(ans); } }