結果

問題 No.1528 Not 1
ユーザー kakel-san
提出日時 2024-05-11 23:59:59
言語 C#
(.NET 8.0.404)
結果
AC  
実行時間 79 ms / 2,000 ms
コード長 1,130 bytes
コンパイル時間 10,398 ms
コンパイル使用メモリ 169,740 KB
実行使用メモリ 193,312 KB
最終ジャッジ日時 2024-12-20 08:54:42
合計ジャッジ時間 13,930 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 19
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (117 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static int NN => int.Parse(ReadLine());
    static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();
    static int[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var n = NN;
        var ans = Not1(n);
        WriteLine(string.Join(" ", ans));
    }
    static List<int> Not1(int n)
    {
        var ans = new List<int>();
        if (n < 3)
        {
            ans.Add(1);
        }
        else if (n == 4)
        {
            ans.Add(2);
            ans.Add(4);
        }
        else if (n == 3 || n == 5)
        {
            ans.Add(-1);
        }
        else
        {
            ans.Add(3);
            ans.Add(6);
            ans.Add(2);
            ans.Add(4);
            for (var i = 8; i <= n; i += 2) ans.Add(i);
            ans = ans.Take((n + 1) / 2).ToList();
        }
        return ans;
    }
}
0