結果
問題 | No.1350 2019-6problem |
ユーザー |
![]() |
提出日時 | 2021-01-17 13:19:03 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 31 ms / 2,000 ms |
コード長 | 743 bytes |
コンパイル時間 | 173 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-11-29 13:50:43 |
合計ジャッジ時間 | 1,603 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
import mathdef lcm(a,b):return a*b//(math.gcd(a,b))A,B,K=map(int,input().split())#Aの個数で2分探索sita=0ue=Kfor i in range(100):this=(sita+ue)//2x=thisx+=(this*A)//Bx-=(this*A)//lcm(A,B)if x==K:print(A*this)exit()elif x>K:ue=(sita+ue)//2else:#x<Ksita=(sita+ue)//2x=(this+1)x+=((this+1)*A)//Bx-=((this+1)*A)//lcm(A,B)if x==K:print((this+1)*A)exit()if x>K:kosu=xn=(this+1)*Asa=kosu-Kif n%B==0:n-=Belse:n-=n%Bsa-=1n-=sa*Bprint(n)exit()