結果

問題 No.48 ロボットの操縦
コンテスト
ユーザー 大谷祐翔
提出日時 2025-10-31 11:50:34
言語 C#
(.NET 8.0.404)
結果
AC  
実行時間 58 ms / 5,000 ms
コード長 927 bytes
コンパイル時間 7,522 ms
コンパイル使用メモリ 170,424 KB
実行使用メモリ 187,992 KB
最終ジャッジ日時 2025-10-31 11:50:45
合計ジャッジ時間 10,059 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (120 ミリ秒)。
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

class Program
{
    static void Main(string[] args)
    {
        string inputX = Console.ReadLine()!;
        string inputY = Console.ReadLine()!;
        string inputRange = Console.ReadLine()!;

        int x = int.Parse(inputX);
        int y = int.Parse(inputY);
        int range = int.Parse(inputRange);
        int count = 0;

        if (x <= -1)
        {
            x = Math.Abs(x);
        }
        if (y <= -1)
        {
            count++;
            y =  Math.Abs(y);
            if (x == 0)
            {
                count++;
            }
        }

        int xCount = x / range;
        if (xCount * range < x)
        {
            xCount++;
        }

        int yCount = y / range;
        if (yCount * range < y)
        {
            yCount++;
        }

        if(x != 0)
        {
            count++;
        }

        count += xCount + yCount;

        Console.WriteLine(count);

    }
}
0