結果

問題 No.48 ロボットの操縦
ユーザー YoiTaka
提出日時 2017-02-23 08:45:23
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 24 ms / 5,000 ms
コード長 1,166 bytes
コンパイル時間 1,022 ms
コンパイル使用メモリ 103,936 KB
実行使用メモリ 18,560 KB
最終ジャッジ日時 2025-01-02 18:06:41
合計ジャッジ時間 2,312 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
public class Hello
{
    public static void Main()
    {
        //var sr = new System.IO.StreamReader("test.txt");
        //System.Console.SetIn(sr);

        string line = System.Console.ReadLine().Trim();
        int X = int.Parse(line);
        X = Math.Abs(X);
        line = System.Console.ReadLine().Trim();
        int Y = int.Parse(line);
        line = System.Console.ReadLine().Trim();
        int L = int.Parse(line);

        int count = 0;


        if (Y >= 0)
        {
            count += (int)(Math.Ceiling((double)Y / (double)L));

            if (X != 0)
            {
                count += (int)(Math.Ceiling((double)X / (double)L)) + 1;

                System.Console.WriteLine(count);
                return;
            }
            else
            {
                System.Console.WriteLine(count);
                return;
            }
        }
        else
        {
            Y = Math.Abs(Y);
            count += (int)(Math.Ceiling((double)X / (double)L) + 1);
            count += (int)(Math.Ceiling((double)Y / (double)L) + 1);
            System.Console.WriteLine(count);
            return;
        }
    }
}
0