

Hãy luôn nhớ cảm ơn và vote 5*
nếu câu trả lời hữu ích nhé!
a = int(input())
price = [100,20,10,5,1]
n = 0
for x in price:
amount += a/x
a -= x*(a/x)
print(n)
V thôi
Hãy giúp mọi người biết câu trả lời này thế nào?

#include<bits/stdc++.h> using namespace std; int main(){ int n; int tong = 0; cin >> n; while(n != 0){ if (n >= 100){ tong += n / 100; n = n - 100 * ( n / 100 ); } if (n >= 20){ tong += n / 20; n = n - 20 * ( n / 20 ); } if (n >= 10){ tong += n / 10; n = n - 10 * ( n / 10 ); } if (n >= 5){ tong += n / 5; n = n - 5 * ( n / 5 ); } if (n >= 1){ tong += n / 1; n = n - 1 * ( n / 1 ); } } cout << tong; return 0; } Rút gọn#include<bits/stdc++.h> using namespace std; int main(){ int n; int tong = 0; cin >> n; while(n != 0){ if (n >= 100){ tong += n / 100; n = n - 100 * ( n / 100 ); } if (n >= 20){ tong += n / 20; n = n - 20 * ( n / 20 ); } if... xem thêm
Bảng tin