結果

問題 No.232 めぐるはめぐる (2)
ユーザー NoNo
提出日時 2015-06-27 11:21:03
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 2,562 bytes
コンパイル時間 3,795 ms
コンパイル使用メモリ 109,248 KB
実行使用メモリ 24,344 KB
最終ジャッジ日時 2023-09-22 03:07:01
合計ジャッジ時間 9,791 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 RE -
testcase_02 WA -
testcase_03 WA -
testcase_04 RE -
testcase_05 AC 60 ms
20,664 KB
testcase_06 WA -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 60 ms
20,676 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 60 ms
22,760 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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>();

            //たどり着けるか判定
            if (t > ((a > b) ? a : b))
            {
                Console.WriteLine("NO");
                return;
            }


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

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

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


            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