結果

問題 No.3253 Banned Product
コンテスト
ユーザー timi
提出日時 2025-11-25 10:48:27
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 649 bytes
コンパイル時間 405 ms
コンパイル使用メモリ 82,512 KB
実行使用メモリ 81,512 KB
最終ジャッジ日時 2025-11-25 10:48:31
合計ジャッジ時間 4,352 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 1 TLE * 1 -- * 7
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#N,S,T,K=map(int, input().split())
#A=list(map(int, input().split()))

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

T=int(input())
for _ in range(T):
  N,K=map(int, input().split())
  ans=-1
  for i in range(N,-1,-1):
    A=make_divisors(i)
    f=1
    for j in range(len(A)):
      if max(A[j],A[-1-j])<=K:
        f=-1
    if f==1:
      ans=i
      break
    if len(A)==1:
      break
  print(ans)
0