結果

問題 No.48 ロボットの操縦
ユーザー fujitafujita
提出日時 2023-04-25 15:23:25
言語 C#
(.NET 8.0.203)
結果
WA  
実行時間 -
コード長 2,614 bytes
コンパイル時間 16,351 ms
コンパイル使用メモリ 167,292 KB
実行使用メモリ 37,388 KB
最終ジャッジ日時 2024-04-26 20:34:48
合計ジャッジ時間 13,999 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 48 ms
32,620 KB
testcase_01 AC 48 ms
28,544 KB
testcase_02 WA -
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (119 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

using System;
namespace yukicoder
{
    class Program
    {

        static void Main(string[] args)
        {
            var X = int.Parse(Console.ReadLine());
            var Y = int.Parse(Console.ReadLine());
            var L = int.Parse(Console.ReadLine());
            int i = 0, j = 0;
            int count ;
            //int[ , ] ints;
            //ints = new int[X , Y];
            //int[,] player = new int[i , j];

            if(X > i || X < 0)
            {
                count = 1;
            }
            else
            {
                count = 0;
            }

            while (!(X == i && Y == j))
            {
                if (Y > j || Y > 0)
                {
                    for (int g = 0; g < L; g++)
                    {
                        if(j == Y)
                        {
                            break;
                        }
                        j++;
                    }
                    count++;
                    if(!(j == Y))
                    {
                        continue;
                    }
                }
                else if (Y < i || Y < 0)
                {
                    for (int h = 0; h < L; h++)
                    {
                        if (j == Y)
                        {
                            break;
                        }
                        j--;
                    }
                    count++;
                    if (!(j == Y))
                    {
                        continue;
                    }
                }

                if (X > i || X > 0)
                {
                    for (int k = 0; k < L; k++)
                    {
                        if (j == X)
                        {
                            break;
                        }
                        i++;
                    }
                    
                    count++;
                    if (!(i == X))
                    {
                        continue;
                    }
                }
                else if (X < i || X < 0)
                {
                    for (int l = 0; l < L; l++)
                    {
                        if (j == X)
                        {
                            break;
                        }
                        i--;
                    }
                    count++;
                    if (!(i == X))
                    {
                        continue;
                    }
                }
                    
                
            }
            Console.WriteLine(count);
        }
    }
}
0