結果

問題 No.3152 neither multiple of A nor B
ユーザー Shivam kumar Singh
提出日時 2025-05-20 21:48:51
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 29 ms / 2,000 ms
コード長 282 bytes
コンパイル時間 341 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 10,368 KB
最終ジャッジ日時 2025-05-20 21:48:55
合計ジャッジ時間 2,882 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import math
input = lambda: sys.stdin.readline().rstrip()


def solve():
    n, a, b = map(int, input().split())  
    lcm = (a*b)//math.gcd(a, b)
    ans = n - (n//a + n//b) + n//lcm
    print(ans)

t = 1
# t = int(input())
for _ in range(t):
    solve()
0