F.A.Qs Home ProblemSet Status Ranklist Contest LoginRegister
Notice:1:五月份月赛定于5.27日12:30--17:30,欢迎大家来玩! 2:关于OJ的注册可看https://www.lydsy.com/JudgeOnline/wttl/thread.php?tid=5671
大视野在线测评-欢迎您
[ New Thread ]
Problem 3552 >> 卡log^5n/512
mcfx @ 2017-12-04 12:11:06
[ Quote ] [ Edit ] [ Delete ] 1#
T=int(raw_input())
for I in range(T):
n=int(raw_input());t=n;a=0;b=0;c=1;d=[1,1,2,1,4,4,4,3,4,1]
while t>0:t/=2;a+=t
while n>0:c=c*d[n%10]%5;n/=5;b+=n
a=a-b+1
if a>1:a=0
t=3
while b>0:
if b&1:c=c*t%5
t=t*t%5
b/=2
print (a*5+c*6)%10
[Top] [Previous Page] [Next Page]

HOME Back