結果

問題 No.48 ロボットの操縦
ユーザー fujitafujita
提出日時 2023-04-26 09:45:41
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 48 ms / 5,000 ms
コード長 2,065 bytes
コンパイル時間 11,604 ms
コンパイル使用メモリ 170,600 KB
実行使用メモリ 183,040 KB
最終ジャッジ日時 2024-04-27 15:12:06
合計ジャッジ時間 11,082 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
29,184 KB
testcase_01 AC 45 ms
28,672 KB
testcase_02 AC 45 ms
28,672 KB
testcase_03 AC 44 ms
29,172 KB
testcase_04 AC 46 ms
29,056 KB
testcase_05 AC 46 ms
28,672 KB
testcase_06 AC 46 ms
29,044 KB
testcase_07 AC 44 ms
28,416 KB
testcase_08 AC 46 ms
29,044 KB
testcase_09 AC 45 ms
28,416 KB
testcase_10 AC 48 ms
28,416 KB
testcase_11 AC 44 ms
28,672 KB
testcase_12 AC 47 ms
29,040 KB
testcase_13 AC 43 ms
28,544 KB
testcase_14 AC 43 ms
28,672 KB
testcase_15 AC 44 ms
28,672 KB
testcase_16 AC 46 ms
28,416 KB
testcase_17 AC 45 ms
28,544 KB
testcase_18 AC 43 ms
28,672 KB
testcase_19 AC 44 ms
28,672 KB
testcase_20 AC 44 ms
28,672 KB
testcase_21 AC 43 ms
29,056 KB
testcase_22 AC 44 ms
29,184 KB
testcase_23 AC 45 ms
28,536 KB
testcase_24 AC 47 ms
183,040 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (99 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
/home/judge/data/code/Main.cs(12,17): warning CS0219: 変数 'i' は割り当てられていますが、その値は使用されていません [/home/judge/data/code/main.csproj]
/home/judge/data/code/Main.cs(12,24): warning CS0219: 変数 'j' は割り当てられていますが、その値は使用されていません [/home/judge/data/code/main.csproj]
  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)
        {
            int X = int.Parse(Console.ReadLine());
            int Y = int.Parse(Console.ReadLine());
            int L = int.Parse(Console.ReadLine());
            int i = 0, j = 0;
            int count , hosuucount = 0; 

            //向き
            if (Y >= 0 && !(X == 0))//Yが+でxが0以外。
            {
                count = 1;
            }
            else if (Y < 0 && !(X == 0) || Y < 0 && X == 0 )//⑴X軸でYが0以下⑵
            {
                count = 2;
            }
            else
            {
                count = 0;
            }

            //歩数
            if (X > 0)
            {
                if (!(X % L == 0))
                {
                    hosuucount += X / L + 1;
                }
                else
                {
                    hosuucount += X / L;
                }
            }
            else if (X < 0)
            {
                X = X * -1;
                if (!(X % L == 0))
                {
                    hosuucount += X / L + 1;
                }
                else
                {
                    hosuucount += X / L;
                }
            }
            else
            {
                hosuucount += 0;
            }


            if (Y > 0)
            {
                if (!(Y % L == 0))
                {
                    hosuucount += (Y / L) + 1;
                }
                else
                {
                    hosuucount += Y / L;
                }
            }
            else if (Y < 0)
            {
                Y = Y * -1;
                if (!(Y % L == 0))
                {
                    hosuucount += (Y / L) + 1;
                }
                else
                {
                    hosuucount += Y / L;
                }
            }
            else
            {
                hosuucount += 0;
            }
            Console.WriteLine(count + hosuucount);
        }
    }
}
0