結果
問題 |
No.48 ロボットの操縦
|
ユーザー |
|
提出日時 | 2016-09-15 15:33:23 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 655 bytes |
コンパイル時間 | 3,492 ms |
コンパイル使用メモリ | 75,888 KB |
実行使用メモリ | 41,560 KB |
最終ジャッジ日時 | 2024-11-17 06:05:15 |
合計ジャッジ時間 | 9,349 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 WA * 1 |
ソースコード
import java.util.Scanner; public class No048 { public static void main(String args[]){ int x = 0; int y = 0; int distance = 0; int go = 0; int turn = 0; Scanner sc = new Scanner(System.in); x = sc.nextInt(); y = sc.nextInt(); go = sc.nextInt(); //回頭に要する行為判定 if(0<y && x==0){ turn = 0; }else if(0<y){ turn = 1; }else if(y<0){ turn = 2; y=y*-1; } if(y!=0){ while(true){ y=y-go; turn++; if(y<=0){ break; } } } if(x<0){x=x*-1;} if(x!=0){ while(true){ x=x-go; turn++; if(x<=0){ break; } } } System.out.println(turn); } }