We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
# Enter your code here. Read input from STDIN. Print output to STDOUTc,m,n=map(int,input().split())ifn==1:print("0")else:arr=[0foriinrange(2*n+2)]arr[0]=0arr[1]=cl=[]foriinrange(2,2*n+2):arr[i]=(arr[i-1]+arr[i-2])%mforiinrange(2,2*n-2,2):temp=(arr[i]*arr[i+2]+arr[i+1]*arr[i+3])%ml.append(temp)temp=(arr[i]*arr[i+4]+arr[i+1]*arr[i+5])%ml.append(temp)temp=(arr[2*n-2]*arr[2*n]+arr[2*n-1]*arr[2*n+1])%ml.append(temp)l=set(l)print(len(l))
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Scalar Products
You are viewing a single comment's thread. Return to all comments →
Python3 solution