結果

問題 No.478 一般門松列列
ユーザー 14番14番
提出日時 2017-01-28 03:28:30
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 57 ms / 2,000 ms
コード長 1,679 bytes
コンパイル時間 2,228 ms
コンパイル使用メモリ 107,312 KB
実行使用メモリ 23,940 KB
最終ジャッジ日時 2023-08-25 12:45:24
合計ジャッジ時間 5,518 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
23,888 KB
testcase_01 AC 52 ms
21,888 KB
testcase_02 AC 54 ms
21,780 KB
testcase_03 AC 52 ms
21,832 KB
testcase_04 AC 52 ms
21,776 KB
testcase_05 AC 52 ms
23,908 KB
testcase_06 AC 52 ms
21,788 KB
testcase_07 AC 52 ms
21,864 KB
testcase_08 AC 53 ms
21,800 KB
testcase_09 AC 52 ms
21,888 KB
testcase_10 AC 53 ms
23,912 KB
testcase_11 AC 56 ms
23,940 KB
testcase_12 AC 55 ms
23,884 KB
testcase_13 AC 56 ms
21,892 KB
testcase_14 AC 56 ms
21,880 KB
testcase_15 AC 57 ms
21,868 KB
testcase_16 AC 55 ms
21,920 KB
testcase_17 AC 56 ms
23,896 KB
testcase_18 AC 56 ms
21,952 KB
testcase_19 AC 56 ms
21,768 KB
testcase_20 AC 55 ms
21,924 KB
testcase_21 AC 57 ms
23,832 KB
testcase_22 AC 56 ms
21,840 KB
testcase_23 AC 57 ms
21,768 KB
testcase_24 AC 57 ms
21,872 KB
testcase_25 AC 57 ms
19,908 KB
testcase_26 AC 55 ms
23,888 KB
testcase_27 AC 53 ms
21,772 KB
testcase_28 AC 53 ms
21,908 KB
testcase_29 AC 54 ms
21,816 KB
testcase_30 AC 55 ms
19,736 KB
testcase_31 AC 55 ms
23,896 KB
testcase_32 AC 53 ms
21,780 KB
testcase_33 AC 56 ms
21,952 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.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Text;
 
public class Program
{
    public void Proc() {
        Reader.IsDebug = false;
        int[] inpt = Reader.ReadLine().Split(' ').Select(a=>int.Parse(a)).ToArray();
        List<int> ans = new List<int>();

        int itemCount = inpt[0];
        int k = inpt[1];

        ans.Add(1);
        ans.Add(2);

        for(int i=0; i<k; i++) {
            ans.Add(ans[ans.Count-2]);
        }
        for(int i=ans.Count; i<itemCount; i++) {
            if(ans[i-2] > ans[i-1]) {
                if(ans[i-2]-ans[i-1] > 2) {
                    ans.Add(ans[i-1]+1);
                } else {
                    ans.Add(ans[i-2]+1);
                }
            } else {
                if(ans[i-1]-ans[i-2] >= 2) {
                    ans.Add(ans[i-2]+1);
                } else {
                    ans.Add(ans[i-2]-1);
                }
            }
        }
        Console.WriteLine(string.Join(" ", ans));

    }


    public class Reader {
        public static bool IsDebug = true;
        private static System.IO.StringReader SReader;
        private static string InitText = @"


20170 7777

";
        public static string ReadLine() {
            if(IsDebug) {
                if(SReader == null) {
                    SReader = new System.IO.StringReader(InitText.Trim());
                }
                return SReader.ReadLine();
            } else {
                return Console.ReadLine();
            }
        }
    }
    public static void Main(string[] args)
    {
        Program prg = new Program();
        prg.Proc();
    }
}
0