結果

問題 No.48 ロボットの操縦
ユーザー bayashiko_rbayashiko_r
提出日時 2018-11-03 17:07:37
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 26 ms / 5,000 ms
コード長 792 bytes
コンパイル時間 2,873 ms
コンパイル使用メモリ 106,980 KB
実行使用メモリ 26,056 KB
最終ジャッジ日時 2024-04-30 21:20:56
合計ジャッジ時間 3,676 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
22,068 KB
testcase_01 AC 25 ms
24,152 KB
testcase_02 AC 24 ms
23,792 KB
testcase_03 AC 25 ms
25,952 KB
testcase_04 AC 24 ms
23,656 KB
testcase_05 AC 24 ms
24,052 KB
testcase_06 AC 25 ms
21,808 KB
testcase_07 AC 26 ms
25,952 KB
testcase_08 AC 24 ms
23,784 KB
testcase_09 AC 24 ms
24,008 KB
testcase_10 AC 24 ms
23,784 KB
testcase_11 AC 24 ms
23,984 KB
testcase_12 AC 24 ms
23,788 KB
testcase_13 AC 24 ms
23,656 KB
testcase_14 AC 24 ms
23,776 KB
testcase_15 AC 25 ms
26,056 KB
testcase_16 AC 24 ms
23,752 KB
testcase_17 AC 25 ms
25,796 KB
testcase_18 AC 24 ms
23,604 KB
testcase_19 AC 24 ms
23,904 KB
testcase_20 AC 26 ms
25,920 KB
testcase_21 AC 24 ms
23,680 KB
testcase_22 AC 24 ms
23,652 KB
testcase_23 AC 24 ms
23,780 KB
testcase_24 AC 25 ms
23,780 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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(string[] args) {
        //入力
        int X = int.Parse(Console.ReadLine());
        int Y = int.Parse(Console.ReadLine());
        int L = int.Parse(Console.ReadLine());

        //答えとなる数
        int ans = 0;

        //X方向に必要となる回数
        if (X != 0) {
            ans += 1 + (Math.Abs(X) - 1) / L;
        }
        
        //Y方向に必要となる回数
        if (Y != 0) {
            ans += 1 + (Math.Abs(Y) - 1) / L;
        }
        
        //エリアによって場合分け
        if (Y < 0) {
            ans += 2;
        } else if (X == 0) {
            //何も足さない
        } else {
            ans += 1;
        }
        //出力
        Console.WriteLine(ans);
    }
}
0