fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. long long n;
  7. cin >> n;
  8. bool z = false;
  9. long long zc = 0;
  10. string nb;
  11. for(long long i = 0; i < n; i++)
  12. {
  13. bool f = false;
  14. string x;
  15. cin >> x;
  16. if(x[0] == '1')
  17. {
  18. f = true;
  19. }
  20. else if(x[0] == '0')
  21. {
  22. z = true;
  23. break;
  24. }
  25. else
  26. {
  27. nb = x;
  28. }
  29. if(f)
  30. {
  31. for(long long j = 1; j < x.size(); j++)
  32. {
  33. if(x[j] == '0')
  34. {
  35. zc++;
  36. }
  37. else
  38. {
  39. nb = x;
  40. break;
  41. }
  42. }
  43. }
  44. }
  45. if(z)
  46. {
  47. cout << "0" << endl;
  48. }
  49. else
  50. {
  51. if(nb.size() != 0)
  52. {
  53. cout << nb;
  54. }
  55. else
  56. {
  57. cout << "1";
  58. }
  59. for(long long i = 0; i < zc; i++)
  60. {
  61. cout << "0";
  62. }
  63. cout << endl;
  64. }
  65. return 0;
  66. }
Success #stdin #stdout 0s 3420KB
stdin
3
10 10 10
stdout
1000