**------------恢复内容开始------------**
codeforce 1474B Different Divisors 模拟 素数筛 C
B. Different Divisors
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
Positive integer x">xx is called divisor of positive integer y">yy, if y">yy is divisible by x">xx without remainder. For example, 1">11 is a divisor of 7">77 and 3">33 is not divisor of 8">88.
We gave you an integer d">dd and asked you to find the smallest positive integer a">aa, such that
- a">aa has at least 4">44 divisors;
- difference between any two divisors of a">aa is at least d">dd.
Input
The first line contains a single integer t">tt (1≤t≤3000">1≤t≤30001≤t≤3000) — the number of test cases.
The first line of each test case contains a single integer d">dd (1≤d≤10000">1≤d≤100001≤d≤10000).
Output
For each test case print one integer a">aa — the answer for this test case.
Example
input
Copy
2
1
2
output
Copy
6
15
Note
In the first test case, integer 6">66 have following divisors: [1,2,3,6]">[1,2,3,6][1,2,3,6]. There are 4">44 of them and the difference between any two of them is at least 1">11. There is no smaller integer with at least 4">44 divisors.
In the second test case, integer 15">1515 have following divisors: [1,3,5,15]">[1,3,5,15][1,3,5,15]. There are 4">44 of them and the difference between any two of them is at least 2">22.
The answer 12">1212 is INVALID because divisors are [1,2,3,4,6,12]">[1,2,3,4,6,12][1,2,3,4,6,12]. And the difference between, for example, divisors 2">22 and 3">33 is less than d=2">d=2d=2.
b=001011">a=101110">d=102121">d">分析
要求两个因子之间至少差d,至少四个,最好是素数
那数据1e4。也不大,打表素数,挨个寻找,找到两个就可以了。
b=001011">a=101110">d=102121">d">代码
https://codeforces.com/contest/1474/submission/105586801
#include
#include
#include
#include
#include
#include <string.h>
#include
#include
#include <string>
#include
#include
#include
#include
#include
#include