結果
| 問題 |
No.8023 素数判定するだけ
|
| コンテスト | |
| ユーザー |
yosupot
|
| 提出日時 | 2017-04-01 02:27:52 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 1,000 ms |
| コード長 | 551 bytes |
| コンパイル時間 | 644 ms |
| コンパイル使用メモリ | 106,864 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-12 18:35:02 |
| 合計ジャッジ時間 | 4,099 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 25 |
コンパイルメッセージ
Main.d(8): Deprecation: const variable `ONE` initialization is not allowed in `static this` Main.d(8): Use `shared static this` instead. Main.d(10): Deprecation: const variable `TWO` initialization is not allowed in `static this` Main.d(10): Use `shared static this` instead. Main.d(11): Deprecation: const variable `BIG` initialization is not allowed in `static this` Main.d(11): Use `shared static this` instead.
ソースコード
import std.stdio, std.algorithm, std.range, std.conv;
import std.bigint, std.string;
const int ONE, TWO, BIG;
static this() {
auto r = iota('a'.to!int);
r.popFront;
ONE = r.front;
r.popFront;
TWO = r.front;
BIG = iota('a'.to!int).map!(x => iota('a'.to!int).sum).sum;
}
void main() {
int n = readln.strip.to!int;
if (n == ONE) {
writeln("NO");
return;
}
foreach (i; TWO..min(n, BIG)) {
if (!(n % i)) {
writeln("NO");
return;
}
}
writeln("YES");
}
yosupot