結果

問題 No.48 ロボットの操縦
ユーザー TDTD
提出日時 2022-05-27 09:16:37
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,801 bytes
コンパイル時間 3,138 ms
コンパイル使用メモリ 106,964 KB
実行使用メモリ 23,924 KB
最終ジャッジ日時 2023-10-20 19:38:14
合計ジャッジ時間 4,567 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 22 ms
23,824 KB
testcase_01 AC 22 ms
23,824 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 21 ms
23,824 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

namespace yukicoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int x = int.Parse(Console.ReadLine());
            int y = int.Parse(Console.ReadLine());
            int l = int.Parse(Console.ReadLine());
            int count = 0;
            if (y < 0)//y==-
            {
                if (x < 0)
                {
                    count++;
                    x *= -1;
                    count = Kxy(count, x, l);
                    count++;
                    y *= -1;
                    count = Kxy(count, y, l);
                }
                else
                {
                    count = Kxy(count, x, l);
                    count++;
                    y *= -1;
                    count = Kxy(count, y, l);
                }
                if (y == 0)
                {
                    Console.WriteLine(count);
                }
            }
            else//y==+
            {
                count = Kxy(count, y, l);
                if (x == 0)
                {
                    Console.WriteLine(count);
                }
                if (x < 0)//x -
                {
                    count++;
                    x *= -1;
                   count= Kxy(count, x, l);
                    Console.WriteLine(count);
                }
                else if (x > 0)
                {
                    count = Kxy(count, x, l);
                        Console.WriteLine(count);
                    
                }
            }
            static int Kxy(int count,int x,int l)
            {
                count += x / l;
                if (x % l != 0)
                {
                    count += x % l;
                }
                return count;
            }
        }
    }
}
0