結果

問題 No.2259 Gas Station
コンテスト
ユーザー yicode
提出日時 2023-06-13 11:02:02
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 567 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,434 ms
コンパイル使用メモリ 184,396 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2026-03-05 18:20:21
合計ジャッジ時間 2,208 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 7 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
long long primeNumber(long long x) {
  bool fire = true;
  for(int i = 2; i <= sqrt(x); i++) {
    if(x % i == 0) {
      fire = false;
    }
  }
  return fire;
}
int main() {
  long long L,R,C; cin >> L >> R >> C;
  long long ans = 1ll << 60ll;
  int count = 0;
  for(int i = L; i <= R; i++) {
    long long X = i * C;
    long long A = 1000 - (X % 1000);
    ans = min(ans,A);
    count++;
    if(count >= 1500) {
      break;
    }
  }
  cout << ans << endl;
}
0