Maruf_Hasan

minimum number trailing zeros

Oct 18th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4.  
  5. int main()
  6. {
  7. int n,k,i,num=0;
  8. vector<int>v;
  9. scanf("%d",&n);
  10. while(n!=0)
  11. {
  12. k=n%10;
  13. v.push_back(k);
  14. n/=10;
  15. }
  16. sort(v.begin(),v.end());
  17. int count=0,temp;
  18. for(i=0;i<v.size();i++)
  19. {
  20. if(v[i]==0)
  21. {
  22. count++;
  23. }
  24. }
  25.  
  26.  
  27. for(i=count;i<v.size();i++)
  28. {
  29. num=num*10;
  30. num+=v[i];
  31. if(i==count){
  32. num=num*int(pow(10.0,(double)count));
  33.  
  34. }
  35. }
  36. cout<<num<<endl;
  37. return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment