結果

問題 No.3152 neither multiple of A nor B
ユーザー urunea
提出日時 2025-05-22 04:17:25
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 212 bytes
コンパイル時間 596 ms
コンパイル使用メモリ 82,068 KB
実行使用メモリ 53,728 KB
最終ジャッジ日時 2025-05-22 04:17:31
合計ジャッジ時間 4,537 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other TLE * 1 -- * 39
権限があれば一括ダウンロードができます

ソースコード

diff #

N,A,B=(int(x) for x in input().split())
ans=N-N//A-N//B
if A <= B:
  A,B=B,A
k = A
i=1
K=True
while True:
  if k%B==0:
    break
  else:
    i += 1
    k = A*i
  
  if k > N:
    K=False
    break
print(ans+N//k)
0