fork(1) download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. int n,mul=1;
  6. cin>>n;
  7. int a[n];
  8. for(int i=0;i<n;i++)
  9. {cin>>a[i];
  10. mul=mul*a[i];}
  11. if(mul>10^18)
  12. cout<<-1<<endl;
  13. else
  14. cout<<mul<<endl;
  15. return 0;
  16. }
Success #stdin #stdout 0s 4456KB
stdin
31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0
stdout
-1