結果
問題 | No.2259 Gas Station |
ユーザー |
|
提出日時 | 2023-04-07 21:35:26 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 45 ms / 2,000 ms |
コード長 | 571 bytes |
コンパイル時間 | 3,116 ms |
コンパイル使用メモリ | 158,304 KB |
最終ジャッジ日時 | 2025-02-12 00:41:59 |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <utility> #include <map> #include <set> #include <queue> #include <iomanip> #include <cstring> #include <atcoder/all> using namespace std; using namespace atcoder; typedef long long ll; #define rep(i,n) for (int i = 0; i < int(n);i++) int main(){ ll l,r,c; cin >> l >> r >> c; ll ans = 1000; for (ll i = l; i <= min(l + 2000,r);i++){ if ((i*c)%1000 == 0) { ans = 0; break; } ans = min(ans,1000-(i*c)%1000); } cout << ans << endl; return 0; }