Official
A - Scary Fee Editorial by en_translator
For beginners
- If you are new to learning programming and do not know where to start, please try Problem A "Welcome to AtCoder" from practice contest. There you can find a sample code for each language.
- Also, if you are not familiar with problems in programming contests, we recommend you to try some problems in "AtCoder Beginners Selection".
- 「競プロ典型 90 問」(Typical 90 Problems of Competitive Programming) is a collection of typical 90 competitive programming problems; unfortunately, currently the problem statements are all Japanese.
- 「C++入門 AtCoder Programming Guide for beginners (APG4b)」 is a C++ tutorial for competitive programmers. Sadly, this is only in Japanese too.
- 「Python入門 AtCoder Programming Guide for beginners (APG4bPython)」 is a Python tutorial for competitive programmers. Again, this is only in Japanese.
Implementation approach
Let \(1000m\) be the amount of withdrawal. Then the condition \(1000m + Cm \leq X\) must be met.
Therefore, the maximum possible \(M\) is the quotient when \(X\) is divided by \((1000+C)\), rounded down. The answer can be obtained by multiplying this by \(1000\).
Sample code (C++)
#include <iostream>
using std::cin;
using std::cout;
int main (void) {
int x, c;
cin >> x >> c;
int cnt = x / (1000 + c);
int ans = cnt * 1000;
cout << ans << "\n";
return 0;
}
posted:
last update: