結果

問題 No.2177 Recurring ab
ユーザー Hydru
提出日時 2023-01-06 22:12:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 50 ms / 2,000 ms
コード長 475 bytes
コンパイル時間 230 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 60,544 KB
最終ジャッジ日時 2024-11-30 18:21:33
合計ジャッジ時間 1,921 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())

def comparison_bunsuu(a,b,c,d):
    A=b*c
    B=a*d
    if A>B:
        return True
    else:
        return False

ans=0

for a in range(10):
    for b in range(10):
        if a==b:
            continue
        l=max(a,b)
        r=10**9+1
        while(r-l>1):
            p=(r+l)//2
            X=(a*p+b,p**2-1)
            if(comparison_bunsuu(X[1],X[0],n,1)):
                l=p
            else:
                r=p
        ans+=l-max(a,b)

print(ans)
0