e655. 10852 - Less Prime
Tags : 模數 質數
Accepted rate: 61人/ 61人 ( 100%) [非即時]
評分方式:
Tolerant

最近更新 : 2019-11-12 10:12

Content

令n為 100 ≤ n ≤ 10000 的整數。
請找出一個質數x,x ≤ n,使(n - p*x)為最大值。
其中p為整數,且p*x ≤ n < (p + 1)*x。

Input

輸入的第一行包含一個整數M,代表測資數量。
每組測資一行,每行包含一個數字N (100 ≤ N ≤ 10000)。

Output

對於每組測資,輸出質數x。

Sample Input #1
5
4399
614
8201
101
7048
Sample Output #1
2203
311
4111
53
3527
測資資訊:
記憶體限制: 64 MB
公開 測資點#0 (50%): 1.0s , <1K
公開 測資點#1 (50%): 1.0s , <1K
Hint :
Tags:
模數 質數
出處:
UVA [管理者: ig99lp33lp33 (위즈원) ]

Status Forum 排行

ID User Problem Subject Hit Post Date
41767 s10900156@nh ... (ShanC) e655
猜出來的答案
347 2024-08-25 08:29