結果

問題 No.2259 Gas Station
ユーザー srjywrdnprkt
提出日時 2023-04-22 02:45:52
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 532 bytes
コンパイル時間 1,093 ms
コンパイル使用メモリ 103,504 KB
最終ジャッジ日時 2025-02-12 12:51:04
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <numeric>
#include <deque>
#include <complex>
#include <cassert>

using namespace std;
using ll = long long;

int main(){

    ll L, R, C, ans=1e18, mi;
    cin >> L >> R >> C;
    mi = min(R, L+1000);
    for (ll i=L; i<=mi; i++){
        if (i*C >= 1000) ans = min(i*C % 1000, ans);
        ans = min(1000LL - (i*C) % 1000, ans);
    }

    cout << ans << endl;

    return 0;
}
0