結果

問題 No.2259 Gas Station
ユーザー nmy
提出日時 2023-04-07 21:26:25
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 295 bytes
コンパイル時間 2,022 ms
コンパイル使用メモリ 191,956 KB
最終ジャッジ日時 2025-02-12 00:19:28
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll l, r, c;
  cin >> l >> r >> c;
  ll ans = 1e18;
  for(int i = l; i <= min(r,l+1000); i++){
    ans = min(ans, (1000-i*c%1000)%1000ll);
  }
  cout << ans << endl;
}
0