結果
問題 | No.2751 429-like Number |
ユーザー |
|
提出日時 | 2024-05-22 23:34:27 |
言語 | C# (.NET 8.0.203) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,625 bytes |
コンパイル時間 | 6,917 ms |
コンパイル使用メモリ | 165,008 KB |
実行使用メモリ | 63,744 KB |
最終ジャッジ日時 | 2024-05-22 23:34:49 |
合計ジャッジ時間 | 16,170 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 77 ms
34,304 KB |
testcase_01 | AC | 76 ms
63,744 KB |
testcase_02 | AC | 75 ms
31,104 KB |
testcase_03 | AC | 87 ms
31,104 KB |
testcase_04 | AC | 76 ms
30,976 KB |
testcase_05 | AC | 76 ms
30,976 KB |
testcase_06 | AC | 77 ms
31,208 KB |
testcase_07 | AC | 216 ms
32,640 KB |
testcase_08 | AC | 94 ms
32,512 KB |
testcase_09 | AC | 1,069 ms
32,640 KB |
testcase_10 | AC | 1,065 ms
32,640 KB |
testcase_11 | TLE | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (83 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/
ソースコード
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 long[] LList(long n) => Enumerable.Repeat(0, (int)n).Select(_ => long.Parse(ReadLine())).ToArray(); public static void Main() { Solve(); } static void Solve() { var p = new List<int>(); for (var i = 2; i < 100000; ++i) { if (IsPrime(i)) p.Add(i); } var q = NN; var a = LList(q); var ans = new bool[q]; for (var i = 0; i < q; ++i) { var x = 0; while (x < p.Count) { if (a[i] % p[x] == 0) break; ++x; } if (x == p.Count) continue; var tmp = a[i] / p[x]; var y = x; while (y < p.Count) { if (tmp % p[y] == 0) break; ++y; } if (y == p.Count) continue; var z = tmp / p[y]; if (IsPrime(z)) ans[i] = true; } WriteLine(string.Join("\n", ans.Select(f => f ? "Yes" : "No"))); } static bool IsPrime(long 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; } }