社区讨论
90分求助
B3836[GESP202303 二级] 百鸡问题参与者 3已保存回复 8
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 8 条
- 当前快照
- 1 份
- 快照标识符
- @lya1scc7
- 此快照首次捕获于
- 2024/07/06 19:35 2 年前
- 此快照最后确认于
- 2024/07/06 21:58 2 年前
CPP
#include<bits/stdc++.h>
using namespace std;
int x,y,z,m,n;
int ans;
int main(){
scanf("%d%d%d%d%d",&x,&y,&z,&n,&m);
for(int a=0;a<=m/x;++a){
for(int b=0;b<=m/y;++b){
if(x*a+y*b+(m-a-b)/z==n&&(m-a-b)%z==0)
++ans;
}
}
printf("%d",ans);
return 0;
}
回复
共 8 条回复,欢迎继续交流。
正在加载回复...