結果
問題 |
No.407 鴨等素数間隔列の数え上げ
|
ユーザー |
![]() |
提出日時 | 2016-08-05 23:02:45 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 144 ms / 1,000 ms |
コード長 | 1,065 bytes |
コンパイル時間 | 852 ms |
コンパイル使用メモリ | 80,316 KB |
実行使用メモリ | 23,068 KB |
最終ジャッジ日時 | 2024-12-15 21:59:33 |
合計ジャッジ時間 | 6,223 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 31 |
ソースコード
#define _CRT_SECURE_NO_WARNINGS // #pragma warning(disable:4996) #include <iostream> #include <cstdio> #include <algorithm> #include <vector> #include <string> #include <queue> #include <functional> #include <sstream> #include <cmath> #include <set> #include <map> using namespace std; #define rep(i,a,b) for(int i=(a);i<(b);i++) #define pb push_back #define mp(a,b) make_pair(a,b) #define all(a) a.begin(),a.end() #define len(x) ((int)(x).size()) #define tmax(a,b,c) max((a),max((b),(c))) #define debug(x) cerr << #x << " is " << x << endl; typedef pair<int, int> Pii; typedef vector<int> V; typedef vector<vector<int> > VV; typedef long long ll; const int inf = 2e9; const int mod = 1e9 + 7; const long double eps = 1e-10; const int maxsize = 5004170; int p[5004170]; // 22237^2237 int main() { int N, L; cin >> N >> L; rep(i,2,2237) { int t = i; while (t+i < maxsize) { t += i; p[t]++; } } ll ans = 0; rep(i,2,maxsize) { if (p[i]) continue; if (i*(N-1) > L) break; ans += L - (i*(N-1)) + 1; } cout << ans << endl; return 0; }