Advertisement
Guest User

Untitled

a guest
Sep 29th, 2020
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. let a = gets();
  2. a=a.split('');
  3. let fin=0;
  4.  
  5.  
  6.  
  7. if (a[0]==0||a[1]==0||a[2]==0) {
  8. a.sort(function(a, b){return a - b});
  9. if (a[1]*a[2]<=Number(a[1])+Number(a[2])) {
  10.  
  11. fin =Number(a[1])+Number(a[2]);
  12. }
  13. else{fin=Number(a[1])*Number(a[2])}
  14. }
  15. if (a[0]!=0&&a[1]!=0&&a[2]!=0) {
  16. a.sort(function(a, b){return a - b});
  17. if (a[0]==1) {
  18.  
  19. fin=Number(a[0])+Number(a[1])*Number(a[2]);
  20. }
  21. else{fin=Number(a[0])*Number(a[1])*Number(a[2]);}
  22. }
  23. if (a[0]==1&&a[1]==1&&a[2]==1) {
  24. fin=3;
  25. }
  26. print(fin);
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement