# 13557 - Anya coin ga suki >author: Utin ###### tags: `math` --- ## Brief See the code below ## Solution 0 ```c= #include<stdio.h> int main() { int p, a, b, c, d; int sum = 0; scanf("%d %d %d %d %d", &p, &a, &b, &c, &d); if(p / 50 > 0) { if(p / 50 > d) { sum += d; p -= 50*d; } else { sum += p/50; p %= 50; } } if(p / 10 > 0) { if(p / 10 > c) { sum += c; p -= 10*c; } else { sum += p/10; p %= 10; } } if(p / 5 > 0) { if(p / 5 > b) { sum += b; p -= 5*b; } else { sum += p/5; p %= 5; } } if(p > 0) { if(p > a) { printf("%d\n", -1); return 0; } else { sum += p; } } printf("%d\n", sum); return 0; } // By Utin ``` ## Reference
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up