SHARE
TWEET

Untitled

a guest Jan 19th, 2020 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. import java.util.Scanner;
  3.  
  4. public class Problem6 {
  5.     public static void main(String[] args) {
  6.         Scanner scanner = new Scanner(System.in);
  7.  
  8.          String input = scanner.nextLine(); // 145
  9.         char sum = 1;
  10.         char totalSum = 0;
  11.  
  12.          for (int i = input.length()-1 ; i >=0 ; i--){ // 5
  13.              int  num = Integer.parseInt("" + input.charAt(i));
  14.              if (num == 0 ){
  15.                sum += 0;
  16.              }else {
  17.                  while (num>=1){
  18.                      sum *= num;
  19.                      num--;
  20.                  }
  21.              }
  22.             totalSum +=sum;
  23.          }
  24.          int nummm = Integer.parseInt(input);
  25.  
  26.          if (totalSum==nummm){
  27.              System.out.println("yes");
  28.          }else{
  29.              System.out.println("no");
  30.          }
  31.  
  32.     }
  33. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top