結果

問題 No.83 最大マッチング
ユーザー Wataru MaedaWataru Maeda
提出日時 2018-10-03 20:41:56
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 43 ms / 5,000 ms
コード長 741 bytes
コンパイル時間 835 ms
コンパイル使用メモリ 103,936 KB
実行使用メモリ 22,480 KB
最終ジャッジ日時 2024-04-20 14:49:54
合計ジャッジ時間 1,766 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
17,920 KB
testcase_01 AC 25 ms
17,536 KB
testcase_02 AC 27 ms
17,920 KB
testcase_03 AC 27 ms
18,048 KB
testcase_04 AC 27 ms
17,792 KB
testcase_05 AC 28 ms
17,664 KB
testcase_06 AC 27 ms
17,920 KB
testcase_07 AC 27 ms
17,536 KB
testcase_08 AC 28 ms
17,920 KB
testcase_09 AC 29 ms
18,560 KB
testcase_10 AC 38 ms
20,996 KB
testcase_11 AC 43 ms
22,272 KB
testcase_12 AC 42 ms
22,480 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.Text;

namespace Problem083
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var ans = new List<int>();
            Process(n, ans);
            ans.Sort();
            ans.Reverse();
            Console.WriteLine(string.Join("", ans));
        }

        static void Process(int n, List<int> ans)
        {
            if (n >= 2 && n != 3)
            {
                ans.Add(1);
                n -= 2;
            }
            else if (n >= 3)
            {
                ans.Add(7);
                n -= 3;
            }
            if (n >= 2) Process(n, ans);
        }
    }
}
0