NEUQ OJ 1202 人民币问题

版权声明:文章原创,未经允许请勿转载 https://blog.csdn.net/DanBo_C/article/details/89977420

1202 人民币问题

题目描述
给出任意的人民币(>=10元)的整币兑换成5元、2元和1元币值(要求三种币值均有)的方法有多少种。

输入描述
输入任意的人民币(>=10元)的整币100,50,20,10

输出描述
计算出兑换成5元、2元和1元币值(要求三种币值均有)的方法有多少种

代码

#include<iostream>
using namespace std;
int main()
{
	int a,b=0;
	cin>>a;
	while(a>5)
	{
		a=a-5;
		b+=(a-1)/2;
	}
  cout<<b<<endl;
}

猜你喜欢

转载自blog.csdn.net/DanBo_C/article/details/89977420