Problem: Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M.  Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N):    * There exists a non-negative integer p such that X= a_k \times (p+0.5).  Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).

Submission attempts (in order):





#       N M
#       a1 a2 ... aN



def min_hankobaisu(A, M):
    result = 1
    for a in A:
        result = result * a / 2
        if result > M:
            print(0)
            exit(0)
    return int(result)


N, M = map(int, input().split())


A = list(set(list(map(int, input().split()))))
A.sort(reverse=True)





#    if (A[i] / 2 % 2) != (A[i + 1] / 2 % 2):
#        print(0)
#        exit(0)


for i in range(0, len(A)):
    if (A[i] / 2) % 2 == 0:
        print(0)
        exit(0)


min_hankobaisu = min_hankobaisu(A, M)

print(int(M/min_hankobaisu+1)/2)








#       N M
#       a1 a2 ... aN



def min_hankobaisu(A, M):
    result = 1
    for a in A:
        result = result * a /2
        if result > M:
            print(0)
            exit(0)
    return int(result)


N, M = map(int, input().split())


A = list(set(list(map(int, input().split()))))
A.sort(reverse=True)




for i in range(0, len(A) - 1):
    if (A[i] / 2 % 2) != (A[i + 1] / 2 % 2):
        print(0)
        exit(0)


min_hankobaisu = min_hankobaisu(A, M)
print(min_hankobaisu)

print(int((M // min_hankobaisu) / 2 + 0.5))






#       N M
#       a1 a2 ... aN



def min_hankobaisu(A, M):
    result = 1
    for a in A:
        result = result * a / 2
        if result > M:
            print(0)
            exit(0)
    return int(result)


N, M = map(int, input().split())


A = list(set(list(map(int, input().split()))))
A.sort(reverse=True)




for i in range(0, len(A) - 1):
    if (A[i] / 2 % 2) != (A[i + 1] / 2 % 2):
        print(0)
        exit(0)


if (A[0] / 2) % 2 == 0:
    print(0)
    exit(0)


min_hankobaisu = min_hankobaisu(A, M)
print('最小半公倍数：{}'.format(min_hankobaisu))
print(int(M/min_hankobaisu+1)/2)








#       N M
#       a1 a2 ... aN



def nankai_2de_warikireruka(n):
    i = 0
    for n in range(99999999999999):
        if n % 2 == 1 or n < 2:
            break
        n = n / 2
        i += 1
    return i


def min_hankobaisu(A, M):
    result = 1
    for a in A:
        result = result * a / 2
        if result > M:
            print(0)
            exit(0)
    return int(result)


N, M = map(int, input().split())


A = list(set(list(map(int, input().split()))))
A.sort(reverse=True)




p = nankai_2de_warikireruka(A[0])

for i in range(1, len(A)):
    pi = nankai_2de_warikireruka(A[i])
    if pi != p:
        print(0)
        exit(0)



#    if (A[i] / 2) % 2 == 0:
#        print(0)
#        exit(0)


min_hankobaisu = min_hankobaisu(A, M)

print(int(M/min_hankobaisu+1)/2)








#       N M
#       a1 a2 ... aN



def nankai_2de_warikireruka(n):
    i = 0
    for n in range(99999999999999):
        if n % 2 == 1 or n < 2:
            break
        n = n / 2
        i += 1
    return i


def min_hankobaisu(A, M):
    result = 1
    for i in range(9999999999999):
        result = A[0] * (0.5 + i)

        if result > M:
            print(0)
            exit(0)



        for j in range(1, len(A)):
 
            
            q, mod = divmod(result, A[j]/2)
  
            if q % 2 == 1 and mod == 0:
                if j == len(A)-1:
                    return int(result)
   
                continue
            else:
    
                break


    return int(result)


N, M = map(int, input().split())


A = list(set(list(map(int, input().split()))))
A.sort(reverse=True)




p = nankai_2de_warikireruka(A[0])
for i in range(1, len(A)):
    pi = nankai_2de_warikireruka(A[i])
    if pi != p:
        print(0)
        exit(0)


min_hankobaisu = min_hankobaisu(A, M)

print(int(M/min_hankobaisu+1)/2)








#       N M
#       a1 a2 ... aN



def min_hankobaisu(A, M):
    result = 1
    for a in A:
        result = result * a / 2
        if result > M:
            print(0)
            exit(0)
    return int(result)


N, M = map(int, input().split())


A = list(set(list(map(int, input().split()))))
A.sort(reverse=True)




for i in range(0, len(A) - 1):
    if (A[i] / 2 % 2) != (A[i + 1] / 2 % 2):
        print(0)
        exit(0)


if (A[0] / 2) % 2 == 0:
    print(0)
    exit(0)


min_hankobaisu = min_hankobaisu(A, M)

print(int(M/min_hankobaisu+1)/2)








#       N M
#       a1 a2 ... aN


def min_hankobaisu(A):
    total_volume = 1
    for a in A:
        total_volume = int(total_volume * a / 2)
    return total_volume

def check_hankobaisu(A,try_X):
    for a in A:
        a = a/2
        if a == 1:
            continue


        if try_X % a != 0:

            return False
        while try_X >= a:
            if try_X % a == 0:
                try_X = try_X / a

            else:
                break

    if try_X == 1:
        return True

    return False


N, M = map(int, input().split())


A = list(set(list(map(int, input().split()))))

hankobaisu_list = []


min_hankobaisu = min_hankobaisu(A)


for try_X in range(min_hankobaisu, M+1, min_hankobaisu):
    if check_hankobaisu(A, try_X):
        hankobaisu_list.append(try_X)

print(hankobaisu_list)
print(len(hankobaisu_list))






#       N M
#       a1 a2 ... aN



def min_hankobaisu(A, M):
    result = 1
    for a in A:
        result = result * a /2
        if result > M:
            print(0)
            exit(0)
    return int(result)


N, M = map(int, input().split())


A = list(set(list(map(int, input().split()))))
A.sort(reverse=True)




for i in range(0, len(A) - 1):
    if (A[i] / 2 % 2) != (A[i + 1] / 2 % 2):
        print(0)
        exit(0)


min_hankobaisu = min_hankobaisu(A, M)

print(int(M/min_hankobaisu+1)/2)








#       N M
#       a1 a2 ... aN



def n_hankobaisu(M, min_hankobaisu):
    q = M // min_hankobaisu
    if q % 2 == 1:
        q += 1
    return int(q/2)


def nankai_2de_warikireruka(n):
    i = 0

    
    for i in range(0,99999999999):
        if n >= 1024 and n % 1024 == 0:
            n = n / 1024
            i += 10
        else:
            break

    for i in range(0,9999999999999999999):
        if n > 1:
            n, mod = divmod(n, 2)
            if mod == 1:
                break
                i += 1
        else:
            break

    return i


def min_hankobaisu(A, M):
    result = 1
    for i in range(9999999999999):
        result = A[0] * (0.5 + i)

        if len(A) == 1:
            return result

        if result > M:
            print(0)
            exit(0)

        for j in range(1, len(A)):
            q, mod = divmod(result, A[j]/2)
            if q % 2 == 1 and mod == 0:
                
                if j == len(A)-1:
                    return int(result)
                continue
            else:
                break 
    return int(result)


N, M = map(int, input().split())


A = list(set(list(map(int, input().split()))))
A.sort(reverse=True)




p = nankai_2de_warikireruka(A[0])

if N == 1:
    print(n_hankobaisu(M, min_hankobaisu(A, M)))
    exit(0)

for i in range(1, len(A)):
    pi = nankai_2de_warikireruka(A[i])
    if pi != p:
        print(0)
        exit(0)






print(n_hankobaisu(M, min_hankobaisu(A, M)))


Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Accepted