結果

問題 No.2259 Gas Station
ユーザー lllllll88938494
提出日時 2023-04-13 03:26:19
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 461 bytes
コンパイル時間 461 ms
コンパイル使用メモリ 82,368 KB
実行使用メモリ 54,104 KB
最終ジャッジ日時 2024-10-09 04:34:17
合計ジャッジ時間 2,271 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

l,r,c=map(int,input().split())

if r-l < 100000:
    ans = 10**10
    for i in range(l,r+1):
        t=i*c
        ans=min(1000-t%1000,ans)
        if t >= 1000:
            ans=min(t%1000,ans)
    print(ans)
    exit()
        

t=l*c // 1000
t1=r*c// 1000

if t1 - t > 0:
    print(0)
else:
    ans = 10**10
    for i in range(l,r+1):
        t=i*c
        ans=min(1000-t%1000,ans)
        if t >= 1000:
            ans=min(t%1000,ans)
    print(ans)
        
0