結果

問題 No.232 めぐるはめぐる (2)
ユーザー NoNo
提出日時 2015-06-28 11:09:35
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 2,659 bytes
コンパイル時間 5,744 ms
コンパイル使用メモリ 104,864 KB
実行使用メモリ 826,056 KB
最終ジャッジ日時 2023-09-22 03:37:43
合計ジャッジ時間 8,697 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 RE -
testcase_02 AC 254 ms
21,908 KB
testcase_03 WA -
testcase_04 RE -
testcase_05 AC 61 ms
20,768 KB
testcase_06 WA -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 WA -
testcase_11 MLE -
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 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 foryuki
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            int t = int.Parse(s[0]);
            int a = int.Parse(s[1]);
            int b = int.Parse(s[2]);

            int[,] z = new int[a, b];
            int x = 0;
            int y = 0;
            List<string> li = new List<string>();

            int k = t;

            //目的地が0,0
            if (a == b && a == 0)
            {
                x--;
                y--;
                k--;
            }

            //斜め移動
            while (x < b - 1 && y < a - 1)
            {
                x++;
                y++;
                k--;
                li.Add(">^");
            }

            //水平移動
            while (x < b - 1)
            {
                x++;
                k--;
                li.Add(">");
            }

            //垂直移動
            while (y > a - 1)
            {
                y++;
                k--;
                li.Add("^");
            }

            if (k < 1)
            {
                Console.WriteLine("NO");
                return;
            }

            while (k > 0)
            {
                //左下 中央下
                if (k == 1)
                {
                    x++;
                    y++;
                    k--;
                    li.Add(">^");
                    break;
                }
                else
                {
                    x++;
                    k--;
                    li.Add(">");
                }

                if (k == 1)
                {
                    y++;
                    k--;
                    li.Add("^");
                    break;
                }
                else
                {
                    x--;
                    k--;
                    li.Add("<");
                }
            }

            Console.WriteLine("YES");
            foreach (var item in li)
            {
                Console.WriteLine(item);
            }
        }

        //-------------------------------------------------------------

        static int[] ConvertStringArrayToIntArray(string[] array)
        {
            return Array.ConvertAll(array, str => int.Parse(str));
        }

        static List<int> ConvertStringArrayToIntList(string[] str)
        {
            var list = new List<int>();
            foreach (var c in str) list.Add(int.Parse(c));
            return list;
        }
    }
}
0