Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int n;
- cin >> n;
- int res = 2e9;
- for(int i = 0; i <= n; i++) {
- int d = 5 * i;
- if(d >= n) {
- if(res > i) {
- res = i;
- }
- }
- if(d <= n) {
- int s = n - d;
- s /= 10;
- if((n - d) % 10 != 0) {
- s++;
- }
- if(i >= s) {
- if(res > i + s) {
- res = i + s;
- }
- }
- }
- }
- cout << res << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement