結果
問題 | No.407 鴨等素数間隔列の数え上げ |
ユーザー |
|
提出日時 | 2018-01-12 04:15:33 |
言語 | D (dmd 2.109.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 696 bytes |
コンパイル時間 | 780 ms |
コンパイル使用メモリ | 114,816 KB |
実行使用メモリ | 11,904 KB |
最終ジャッジ日時 | 2024-06-12 23:30:13 |
合計ジャッジ時間 | 2,881 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 18 WA * 13 |
ソースコード
import std.stdio, std.array, std.string, std.conv, std.algorithm;import std.typecons, std.range, std.random, std.math, std.container;import std.numeric, std.bigint, core.bitop, core.stdc.stdio;immutable int INF = 1 << 28;void main() {auto s = readln.split.map!(to!int);auto N = s[0];auto L = s[1];auto table = new bool[](L+1);table.fill(true);for (int i = 2; i <= L; ++i) {if (!table[i]) continue;for (int j = i+i; j <= L; j += i) {table[j] = false;}}long ans = 0;foreach (d; 2..L+1) {if (!table[d]) continue;long x = (N-1) * d;ans += max(0, L-x+1);}ans.writeln;}