結果
問題 | No.2259 Gas Station |
ユーザー | gyozasukisuki |
提出日時 | 2023-04-07 21:52:48 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 1,713 ms / 2,000 ms |
コード長 | 751 bytes |
コンパイル時間 | 1,500 ms |
コンパイル使用メモリ | 167,744 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-02 19:25:57 |
合計ジャッジ時間 | 11,365 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#include <bits/stdc++.h> using namespace std; const int INF = 1e9; using ll = long long; using inv = vector<int>; using stv = vector<string>; using pint = pair<int,int>; #define FOR(i,l,r) for(int i=(l); i<(r); i++) #define rep(i,r) for(int i=0; i<(r); i++) #define repl(i,r) for(long long i=0; i<(r); i++) #define FORl(i,l,r) for(long long i=(l); i<(r); i++) #define INFL ((1LL<<62)-(1LL<<31)) #define pb(x) push_back(x) #define CIN(x) cin >> x int main(){ ll L,R,C; cin >> L >> R >> C; const ll MOD = 1000; ll minC = L*C; ll maxC = R*C; ll ans = INFL; FORl(i,L,R+1){ ll num = C*i; ll mi = 0; if(num % MOD == 0) mi = 1000; else mi = num % MOD; ans = min(ans, 1000-mi); } cout << ans << endl; }