AcWing 656. 钞票和硬币
原题链接
简单
作者:
Dolores非
,
2025-01-01 17:21:46
,
所有人可见
,
阅读 4
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
using namespace std;
int main()
{
double n;
int m;
cin>>n;
int n1=(int)(n*=100);
int a[6]={100,50,20,10,5,2};
double b[6]={1.00,0.50,0.25,0.10,0.05,0.01};
cout<<"NOTAS:"<<endl;
for(int i=0;i<6;i++)
{
m=n1/a[i]/100;
n1%=(int)(a[i]*100);
cout<<m<<" nota(s) de R$ "<<a[i]<<".00"<<endl;
}
cout<<"MOEDAS:"<<endl;
for(int j=0;j<6;j++)
{
m=n1/b[j]/100;
n1%=(int)(b[j]*100);
printf("%d moeda(s) de R$ %.2lf\n",m,b[j]);
}
return 0;
}