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