95pts求助
查看原帖
95pts求助
1210623
Wang_Xu楼主2024/7/21 09:07
#include<bits/stdc++.h>
using namespace std;
long long x,y,z,n,m;
long long ch=0,ans=0;
int main()
{
	cin>>x>>y>>z>>n>>m;
	for(int x1=0;x1<m;x1++)//枚举数量 
	{
		for(int y1=0;y1<m-x1;y1++)
		{
			ch=m-x1-y1;
			if(ch%z==0)
			{
				long long money=x1*x+y1*y+(ch/z);//总价=单价*数量 
				if(money==n)
				{
					++ans;
				}
			}
		}
	}
	cout<<ans;
	return 0;
}
2024/7/21 09:07
加载中...