結果

問題 No.2259 Gas Station
ユーザー flygonflygon
提出日時 2023-04-07 21:27:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 42 ms / 2,000 ms
コード長 448 bytes
コンパイル時間 132 ms
コンパイル使用メモリ 82,612 KB
実行使用メモリ 56,404 KB
最終ジャッジ日時 2024-04-10 16:36:05
合計ジャッジ時間 1,859 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
54,852 KB
testcase_01 AC 37 ms
54,844 KB
testcase_02 AC 38 ms
55,236 KB
testcase_03 AC 39 ms
54,712 KB
testcase_04 AC 39 ms
54,564 KB
testcase_05 AC 38 ms
55,608 KB
testcase_06 AC 39 ms
54,668 KB
testcase_07 AC 38 ms
55,564 KB
testcase_08 AC 41 ms
55,848 KB
testcase_09 AC 42 ms
55,444 KB
testcase_10 AC 38 ms
54,980 KB
testcase_11 AC 38 ms
54,868 KB
testcase_12 AC 38 ms
55,020 KB
testcase_13 AC 39 ms
55,044 KB
testcase_14 AC 37 ms
55,980 KB
testcase_15 AC 38 ms
56,404 KB
testcase_16 AC 37 ms
55,024 KB
testcase_17 AC 36 ms
55,052 KB
testcase_18 AC 36 ms
54,508 KB
testcase_19 AC 37 ms
54,320 KB
testcase_20 AC 38 ms
54,916 KB
testcase_21 AC 37 ms
54,712 KB
testcase_22 AC 38 ms
54,488 KB
testcase_23 AC 39 ms
54,904 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(5*10**5)
input = sys.stdin.readline
from collections import defaultdict, deque, Counter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
from math import gcd

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

ans = float("inf")
for i in range(l, min(r, l+1000)+1):
    if c * i % 1000 == 0:
        print(0)
        break
    tmp = 1000 - c * i % 1000
    ans = min(ans, tmp)
else:
    print(ans)


0