結果
問題 | No.2259 Gas Station |
ユーザー |
|
提出日時 | 2023-04-07 21:25:30 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 606 bytes |
コンパイル時間 | 1,790 ms |
コンパイル使用メモリ | 192,348 KB |
最終ジャッジ日時 | 2025-02-12 00:17:23 |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#include <bits/stdc++.h>using namespace std;#ifdef _RUTHEN#include <debug.hpp>#else#define show(...) true#endifusing ll = long long;#define rep(i, n) for (int i = 0; i < (n); i++)template <class T> using V = vector<T>;int main() {ios::sync_with_stdio(false);cin.tie(0);long long L, R, C;cin >> L >> R >> C;long long ans = 1LL << 60;for (long long x = L; x <= min(L + 1000000, R); x++) {if (C * x % 1000 == 0) {ans = 0;} else {ans = min(ans, 1000 - C * x % 1000);}}cout << ans << '\n';return 0;}