結果

問題 No.478 一般門松列列
ユーザー 14番14番
提出日時 2017-01-28 03:25:48
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,673 bytes
コンパイル時間 2,377 ms
コンパイル使用メモリ 107,852 KB
実行使用メモリ 25,940 KB
最終ジャッジ日時 2023-08-25 12:45:13
合計ジャッジ時間 8,050 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
21,916 KB
testcase_01 AC 65 ms
21,960 KB
testcase_02 AC 64 ms
23,840 KB
testcase_03 AC 63 ms
23,892 KB
testcase_04 AC 65 ms
21,952 KB
testcase_05 AC 63 ms
21,872 KB
testcase_06 AC 64 ms
23,876 KB
testcase_07 AC 63 ms
19,860 KB
testcase_08 AC 63 ms
23,912 KB
testcase_09 AC 63 ms
21,860 KB
testcase_10 AC 63 ms
21,896 KB
testcase_11 AC 68 ms
22,128 KB
testcase_12 AC 68 ms
23,820 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 66 ms
21,724 KB
testcase_16 WA -
testcase_17 AC 70 ms
23,892 KB
testcase_18 AC 67 ms
19,788 KB
testcase_19 AC 70 ms
23,988 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 66 ms
21,776 KB
testcase_23 AC 69 ms
23,880 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 69 ms
21,868 KB
testcase_28 AC 66 ms
21,796 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 66 ms
21,856 KB
testcase_32 AC 66 ms
22,004 KB
testcase_33 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.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 = @"


100 0

";
        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