fork(1) download
  1. #include <iostream>
  2. #include <cmath>
  3. #include<iomanip>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. long n;int n1,n2,n3,n4,n5;
  10. cin>>n;int x=0;
  11. if ((n%10000!=0)||(n==30000)||(n==10000))
  12. cout<<"0 0";
  13. else
  14. {
  15. n=n/1000;
  16. n1=n/500;
  17. for(int i5=0;i5<=n1;i5++)
  18. for(int i4=0;i4<=(n-i5*500)/200;i4++)
  19. for(int i3=0;i3<=(n-i4*200-i5*500)/100;i3++)
  20. for(int i2=0;i2<=(n-i3*100-i4*200-i5*500)/50;i2++)
  21. for(int i1=0;i1<=(n-i2*50-i3*100-i4*200-i5*500)/20;i1++)
  22. if((500*i5+200*i4+100*i3+50*i2+20*i1)==n)
  23. x++;
  24. cout<<x;}
  25. return 1;
  26. }
  27.  
Runtime error #stdin #stdout 0.04s 4412KB
stdin
8760000
stdout
297933