結果

問題 No.48 ロボットの操縦
ユーザー kimnykimny
提出日時 2017-11-17 21:50:19
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 50 ms / 5,000 ms
コード長 1,212 bytes
コンパイル時間 1,681 ms
コンパイル使用メモリ 102,300 KB
実行使用メモリ 22,844 KB
最終ジャッジ日時 2023-08-16 19:11:52
合計ジャッジ時間 3,978 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
20,832 KB
testcase_01 AC 46 ms
22,752 KB
testcase_02 AC 48 ms
20,700 KB
testcase_03 AC 47 ms
18,852 KB
testcase_04 AC 47 ms
20,896 KB
testcase_05 AC 46 ms
20,836 KB
testcase_06 AC 47 ms
22,844 KB
testcase_07 AC 48 ms
20,716 KB
testcase_08 AC 48 ms
20,880 KB
testcase_09 AC 48 ms
20,784 KB
testcase_10 AC 48 ms
20,824 KB
testcase_11 AC 50 ms
20,720 KB
testcase_12 AC 50 ms
20,832 KB
testcase_13 AC 48 ms
20,720 KB
testcase_14 AC 48 ms
22,840 KB
testcase_15 AC 48 ms
20,712 KB
testcase_16 AC 48 ms
22,784 KB
testcase_17 AC 47 ms
20,792 KB
testcase_18 AC 47 ms
18,724 KB
testcase_19 AC 48 ms
20,728 KB
testcase_20 AC 48 ms
18,832 KB
testcase_21 AC 48 ms
20,780 KB
testcase_22 AC 47 ms
18,624 KB
testcase_23 AC 47 ms
22,840 KB
testcase_24 AC 46 ms
20,656 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace yukicoder_48 {
    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 xa = Math.Abs(x);
            int ya = Math.Abs(y);
            int count = 0;
            //x方向のカウント
            if (xa % l == 0) {
                count += xa / l;
            } else {
                for(int i = 1; xa - i * l > 0; i++) {
                    count++;
                }
                count++;
            }
            //y方向のカウント
            if (ya % l == 0) {
                count += ya / l;
            } else {
                for (int i = 1; ya - i * l > 0; i++) {
                    count++;
                }
                count++;
            }
            //回転回数
            if (y<0){
                count += 2;
            }else if (x != 0) {
                count++;
            }
            Console.WriteLine(count);
            Console.ReadLine();
        }
    }
}
0