1. 程式人生 > >python 牛客 飢餓的小易

python 牛客 飢餓的小易

數學題 1.fg=gf 2.fff=gg

start=int(input())
count1=0
count2=1
count3=2
m=1000000007
start1=start%m
start2=(4*start1+3)%m
start3=(4*start2+3)%m
while count1<100000 and start1!=0:
    start1=(8*start1+7)%m
    count1+=1
while count2<100000 and start2!=0:
    start2=(8*start2+7)%m
    count2+=1
while count3<100000 and
start3!=0: start3=(8*start3+7)%m count3+=1 count=min(count1,count2,count3) count=-1 if count==100000 else count print(count)