結果

問題 No.2610 Decreasing LCMs
ユーザー 👑 kakel-sankakel-san
提出日時 2024-01-19 22:31:09
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 80 ms / 1,000 ms
コード長 1,480 bytes
コンパイル時間 9,502 ms
コンパイル使用メモリ 158,616 KB
実行使用メモリ 180,640 KB
最終ジャッジ日時 2024-01-19 22:31:22
合計ジャッジ時間 9,505 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
32,932 KB
testcase_01 AC 70 ms
32,932 KB
testcase_02 AC 72 ms
32,932 KB
testcase_03 AC 72 ms
32,932 KB
testcase_04 AC 74 ms
32,932 KB
testcase_05 AC 73 ms
32,932 KB
testcase_06 AC 80 ms
32,932 KB
testcase_07 AC 70 ms
32,932 KB
testcase_08 AC 71 ms
32,932 KB
testcase_09 AC 71 ms
32,932 KB
testcase_10 AC 73 ms
32,932 KB
testcase_11 AC 73 ms
32,932 KB
testcase_12 AC 74 ms
32,932 KB
testcase_13 AC 71 ms
32,932 KB
testcase_14 AC 75 ms
32,932 KB
testcase_15 AC 74 ms
32,932 KB
testcase_16 AC 72 ms
32,932 KB
testcase_17 AC 74 ms
32,932 KB
testcase_18 AC 80 ms
32,932 KB
testcase_19 AC 72 ms
32,932 KB
testcase_20 AC 74 ms
32,932 KB
testcase_21 AC 71 ms
32,932 KB
testcase_22 AC 71 ms
180,640 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (112 ms)。
MSBuild のバージョン 17.7.3+8ec440e68 (.NET)
  main -> /home/judge/data/code/bin/Release/net7.0/main.dll
  main -> /home/judge/data/code/bin/Release/net7.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()
    {
        var n = NN;
        var p = new List<int>{ 3 };
        for (var i = 1; i < n; ++i)
        {
            var j = p[^1] * 2;
            while (true)
            {
                if (IsPrime(j))
                {
                    p.Add(j);
                    break;
                }
                --j;
            }
        }
        p.Reverse();
        for (var i = 0; i < p.Count; ++i)
        {
            p[i] <<= i;
        }
        WriteLine(string.Join(" ", p.Take(n)));
    }
    static long LCM(int a, int b)
    {
        var gcd = GCD(a, b);
        return (long)a / gcd * b;
    }
    static int GCD(int a, int b)
    {
        if (a < b) return GCD(b, a);
        if (a % b == 0) return b;
        return GCD(b, a % b);
    }
    static bool IsPrime(int n)
    {
        if (n == 1) return false;
        if (n == 2) return true;
        if (n % 2 == 0) return false;
        int i = 3;
        while (i * i <= n)
        {
            if (n % i == 0) return false;
            i = i + 2;
        }
        return true;
    }
}
0