結果
問題 | No.2259 Gas Station |
ユーザー |
|
提出日時 | 2023-04-08 15:35:23 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 502 bytes |
コンパイル時間 | 4,012 ms |
コンパイル使用メモリ | 227,144 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-03 11:01:41 |
合計ジャッジ時間 | 4,005 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#include <atcoder/all>#include <bits/stdc++.h>using namespace std;using namespace atcoder;using ll = long long;void fast_io() {cin.tie(nullptr);ios_base::sync_with_stdio(false);}int main(void) {fast_io();ll l, r, c;cin >> l >> r >> c;ll ans = 1000;for (ll i = l; i <= min(r, l + 1000); i++) {ll q = c * i / 1000;ll x = 1000 * q - c * i;if (x < 0) x += 1000;ans = min(ans, x);}cout << ans << endl;return 0;}