fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6. int i,n,j,m,cnt=0;
  7. float x,y,z;
  8. cin>>x>>y>>z>>n>>m;
  9. for(i=0;i<=(n/x+1);i++){
  10. for(j=0;j<=(n/y+1);j++){
  11. if(((j*y)+(i*x)+((m-i-j)*(1.0/z))==n)&&(m-i-j>=0)) cnt++;
  12. //cout<<"小鸡="<<m-i-j<<"公鸡="<<i<<"母鸡="<<j<<"\n";
  13. }
  14. }
  15. cout<<cnt<<"\n";
  16. return 0;
  17. }
Success #stdin #stdout 0s 5324KB
stdin
1 1 1 100 100
stdout
5151