AcWing 653. 钞票
原题链接
中等
作者:
卢教主
,
2023-12-13 18:26:04
,
所有人可见
,
阅读 27
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
int A;
cin >> A;
printf("%d\n",A);
int a = 0, b = 0, c =0, d =0, e =0, f = 0, g = 0;
if(A >= 100)
{
a = A / 100;
A = A % 100;
}
if(A >= 50)
{
b = A / 50;
A = A % 50;
}
if(A < 50 && A >= 20)
{
c = A / 20;
A = A % 20;
}
if(A < 20 && A >= 10)
{
d = A / 10;
A = A % 10;
}
if(A < 10 && A >= 5)
{
e = A / 5;
A = A % 5;
}
if(A < 5 && A >= 2)
{
f = A / 2;
A = A % 2;
}
if(A < 2 && A >= 1)
{
g = A / 1;
A = A % 1;
}
printf("%d nota(s) de R$ 100,00\n",a);
printf("%d nota(s) de R$ 50,00\n",b);
printf("%d nota(s) de R$ 20,00\n",c);
printf("%d nota(s) de R$ 10,00\n",d);
printf("%d nota(s) de R$ 5,00\n",e);
printf("%d nota(s) de R$ 2,00\n",f);
printf("%d nota(s) de R$ 1,00\n",g);
return 0;
}