Cod sursa(job #3141407)
Utilizator | Data | 13 iulie 2023 21:48:42 | |
---|---|---|---|
Problema | Zero 2 | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.54 kb |
#include <iostream>
using namespace std;
int main()
{
int n, prod = 1, ex2 = 0, ex5 = 0, x;
cin >> n;
for(int i = 1; i <= n; i++)
{
cin >> x;
while(x % 2 == 0)
{
x /= 2;
ex2++;
}
while(x % 5 ==0)
{
x /= 5;
ex5++;
}
prod = prod * (x % 10) % 10;
}
if(ex5 > ex2)
cout << '5';
else
{
for(int i = 1; i <= ex2 - ex5; i++)
prod = prod * 2 % 10;
cout << prod;
}
return 0;
}