結果

問題 No.48 ロボットの操縦
ユーザー うわばみ
提出日時 2020-04-29 16:21:19
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 974 bytes
コンパイル時間 5,217 ms
コンパイル使用メモリ 110,612 KB
実行使用メモリ 27,608 KB
最終ジャッジ日時 2024-11-28 22:18:54
合計ジャッジ時間 4,584 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 18 WA * 7
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

class Program
{
    static void Main()
    {
        int X = int.Parse(Console.ReadLine());
        int Y = int.Parse(Console.ReadLine());
        int L = int.Parse(Console.ReadLine());
        int x = 0, y = 0, dir = 0, count = 0;
        if(0 < Y)
        {
            while(y < Y)
            {
                y += L;
                count++;
            }
        }
        if(X < 0)
        {
            count++;
            while(X < x)
            {
                x -= L;
                count++;
            }
        }
        else if(0 < X)
        {
            count++;
            while(x < X)
            {
                x += L;
                count++;
            }
        }
        else if(X == 0 && Y < 0)
        {
            count++;
        }
        if(Y < 0)
        {
            while(Y < y)
            {
                y -= L;
                count++;
            }
        }
        Console.WriteLine($"{count}");
    }
}
0