結果
| 問題 | 
                            No.48 ロボットの操縦
                             | 
                    
| コンテスト | |
| ユーザー | 
                             AoiroFukurou
                         | 
                    
| 提出日時 | 2014-12-21 17:54:47 | 
| 言語 | Java  (openjdk 23)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 524 bytes | 
| コンパイル時間 | 3,980 ms | 
| コンパイル使用メモリ | 74,256 KB | 
| 実行使用メモリ | 54,392 KB | 
| 最終ジャッジ日時 | 2024-06-12 03:13:38 | 
| 合計ジャッジ時間 | 8,556 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 18 WA * 7 | 
ソースコード
package benkyoukai;
import java.util.Scanner;
public class Robot {
public static void main(String[] args) {
	int x, y, l;
	int ans=0;
	Scanner sc = new Scanner(System.in);
	x = sc.nextInt();
	y = sc.nextInt();
	l = sc.nextInt();
	x=Math.abs(x);
	if(y==0){
		if(x==0){
			ans = 0;
		}else{
			ans = (x + l -1)/l+1;
		}
	
}
	if(y>0){
		ans = (y+l-1)/l;
		if(x!=0){
			ans +=1+(x+l-1)/l;
		}
			
		}
	if(y<0){
		ans = (y+l-1)/l;
		if(x==0){
			ans +=2;
		}else{
			ans +=(2+(x+l-1)/l);
		}
	}
	System.out.println(ans);
	}
}
            
            
            
        
            
AoiroFukurou