結果

問題 No.2259 Gas Station
コンテスト
ユーザー tamato
提出日時 2023-04-07 21:22:31
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 40 ms / 2,000 ms
コード長 291 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 208 ms
コンパイル使用メモリ 84,736 KB
実行使用メモリ 52,096 KB
最終ジャッジ日時 2026-04-19 02:29:19
合計ジャッジ時間 2,454 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys
input = sys.stdin.readline
mod = 998244353

l, r, c = map(int, input().split())
if r - l >= 1000:
    print(0)
else:
    ans = 10 ** 9
    for i in range(l, r+1):
        tmp = (c * i) % 1000
        if tmp:
            tmp = 1000 - tmp
        ans = min(ans, tmp)
    print(ans)
0