結果

問題 No.2259 Gas Station
ユーザー srjywrdnprkt
提出日時 2023-04-22 02:47:16
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 532 bytes
コンパイル時間 953 ms
コンパイル使用メモリ 104,688 KB
最終ジャッジ日時 2025-02-12 12:51:08
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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 = max(R-1000, L);
    for (ll i=mi; i<=R; i++){
        if (i*C >= 1000) ans = min(i*C % 1000, ans);
        ans = min(1000LL - (i*C) % 1000, ans);
    }

    cout << ans << endl;

    return 0;
}
0