結果
| 問題 | 
                            No.48 ロボットの操縦
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2017-10-17 05:53:58 | 
| 言語 | C#(csc)  (csc 3.9.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 22 ms / 5,000 ms | 
| コード長 | 781 bytes | 
| コンパイル時間 | 4,040 ms | 
| コンパイル使用メモリ | 111,536 KB | 
| 実行使用メモリ | 17,792 KB | 
| 最終ジャッジ日時 | 2024-11-17 21:35:11 | 
| 合計ジャッジ時間 | 2,660 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 25 | 
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.Collections.Generic;
using System.Linq;
public class Program {
    public static int CalculateMoveCount(int distance, int speed) {
        int r;
        var q = Math.DivRem( Math.Abs(distance), speed, out r );
        return r == 0 ? q : q+1;
    }
    public static int Solver(int x, int y, int l) {
        var nY = CalculateMoveCount( y, l );
        var nX =  CalculateMoveCount( x, l ) ;
        var nRot = y > 0 ? ( x == 0 ? 0 : 1 ) : ( y == 0 ? ( x == 0 ? 0 : 1 ) : 2 );
        return nX + nY + nRot;
    }
    private static void Main() {
        var x = int.Parse( Console.ReadLine() );
        var y = int.Parse( Console.ReadLine() );
        var l = int.Parse( Console.ReadLine() );
        Console.WriteLine( Solver( x, y, l ) );
    }
}