eolymp
bolt
Try our new interface for solving problems
published at 7/26/16, 4:58:43 pm

Не проходит последний тест. Все-таки нужно использовать длинную арифметику?

published at 3/5/18, 6:50:13 pm

НЕТ! НИКАКОЙ ДЛИННОЙ АРИФМЕТИКИ!

published at 4/20/18, 8:30:24 pm

Є чи нема там арифметики довгої, але з арифметикою таки 100% без неї 91%...

published at 7/12/18, 10:57:30 am

20 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81

Ответ: 180047533786047748703282400

published at 1/10/24, 6:02:12 pm

include <bits/stdc++.h>

define ll long long

define ld long double

using namespace std; int main(){

ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
ll n, ans = 1;
cin>>n;
for(int i = 0; i<n; i++){
    ll k;
    cin>>k;
    if(k == 0){
        return 0;
    }
    ans = (ans * k) / __gcd(ans, k);
}
cout<<ans;

} //TECHNOBLADE NEVER DIE

published at 1/26/24, 11:31:59 am

//The true code

import math

def lcmoflist(numbers):

lcm = numbers[0]

for i in range(1, len(numbers)):

lcm = lcm * numbers[i] // math.gcd(lcm, numbers[i])

return lcm

n = int(input()) integers = list(map(int, input().split())) result = lcmoflist(integers) print(result)