|
|
back to boardDiscussion of Problem 1607. Taxisimple iterative solution C++ #include <bits/stdc++.h> using namespace std; #define go ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); typedef long long ll; int main() { go int a, b, c, d; cin >> a >> b >> c >> d; while(a < c){ if(a+b > c) break; a += b; c -= d; } cout << max(a, c);
return 0; } |
|
|