Advertisement
saira12tabassum19

Untitled

Jun 13th, 2020
910
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.49 KB | None | 0 0
  1. import java.math.BigInteger;
  2. import java.util.Scanner;
  3. public class Fgh {
  4.  
  5.     public static void main(String[] args) {
  6.         long  n,x,i;
  7.         BigInteger f=new BigInteger("1");
  8.         BigInteger l=new BigInteger("1000000000000000000");
  9.         Scanner inpu=new Scanner(System.in);
  10.         n=inpu.nextLong();
  11.         for(i=0;i<n;i++) {
  12.         x=inpu.nextLong();
  13.         f=f.multiply(BigInteger.valueOf(x));
  14.        
  15.         }
  16.         int val=f.compareTo(l);
  17.         if(val==1)System.out.println("-1");
  18.         else System.out.println(f);
  19.  
  20.     }
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement