AcWing 656. 钞票和硬币
原题链接
简单
作者:
lemoba
,
2024-11-02 14:13:37
,
所有人可见
,
阅读 1
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
double N;
cin >> N;
N = N * 100;
N = (int)N;
cout << "NOTAS:" << endl;
int a = 0;
a = 0;
if (N >= 10000)
{
a = N / 10000;
N = N - a * 10000;
}
cout << a << " nota(s) de R$ 100.00" << endl;
a = 0;
if (N >= 5000)
{
a = N / 5000;
N = N - a * 5000;
}
cout << a << " nota(s) de R$ 50.00" << endl;
a = 0;
if (N >= 2000)
{
a = N / 2000;
N = N - a * 2000;
}
cout << a << " nota(s) de R$ 20.00" << endl;
a = 0;
if (N >= 1000)
{
a = N / 1000;
N = N - a * 1000;
}
cout << a << " nota(s) de R$ 10.00" << endl;
a = 0;
if (N >= 500)
{
a = N / 500;
N = N - a * 500;
}
cout << a << " nota(s) de R$ 5.00" << endl;
a = 0;
if (N >= 200)
{
a = N / 200;
N = N - a * 200;
}
cout << a << " nota(s) de R$ 2.00" << endl;
cout << "MOEDAS:" << endl;
a = 0;
if (N >= 100)
{
a = N / 100;
N = N - a * 100;
}
cout << a << " moeda(s) de R$ 1.00" << endl;
a = 0;
if (N >= 50)
{
a = N / 50;
N = N - a * 50;
}
cout << a << " moeda(s) de R$ 0.50" << endl;
a = 0;
if (N >= 25)
{
a = N / 25;
N = N - a * 25;
}
cout << a << " moeda(s) de R$ 0.25" << endl;
a = 0;
if (N >= 10)
{
a = N / 10;
N = N - a * 10;
}
cout << a << " moeda(s) de R$ 0.10" << endl;
a = 0;
if (N >= 5)
{
a = N / 5;
N = N - a * 5;
}
cout << a << " moeda(s) de R$ 0.05" << endl;
a = 0;
if (N >= 1)
{
a = N / 1;
N = N - a * 1;
}
cout << a << " moeda(s) de R$ 0.01" << endl;
return 0;
}