結果

問題 No.2259 Gas Station
ユーザー yicode
提出日時 2023-06-13 11:03:34
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 611 bytes
コンパイル時間 1,406 ms
コンパイル使用メモリ 168,580 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-12 23:23:04
合計ジャッジ時間 2,193 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#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);
    if(1000 == A) {
      A = 0;
    }
    ans = min(ans,A);
    
    count++;
    if(count >= 1500) {
      break;
    }
  }
  cout << ans << endl;
}
0