2024年5月27日 星期一

queue

 a = list(range(1,31))

i = 1

while len(a)>1:

    if i %3==0:

        a.append(a[0])

    del a[0]

    i = i +1

print(a)

#執行結果

[18]



2024年5月26日 星期日

green judge ...

 https://web.archive.org/web/20210412155705/http://www.tcgs.tc.edu.tw:1218/Problems

2024年5月24日 星期五

交錯字串

 while True:

    try:

        ddd = input()

        print(ddd)

        k = int(input().strip())

        d = input().strip()

        

        dd = ''

        for i in d:

            if i>='a':

              dd+='0'

            else:

                dd+='1'

        

        s = ''

        c = 0

        is0 = True

        isEnd = False

        

        while not isEnd: 

            if is0:

                s += '0'*k

                if s in dd:

                    c += k

                else:

                    isEnd = True

            else:

                s += '1'*k

                if s in dd:

                    c +=k

                else:

                    isEnd = True

            is0 = not is0        

        print(c)

    except:

        break

2024年5月5日 星期日

回家的日子

 def gcd(a,b):

    while a!=b:

        if a>b:

            a = a-b

        else:

            b = b-a

    return a


def lcm(a,b):

    return a*b/gcd(a,b)


n = int(input())

d = [int(i) for i in input().strip().split()]


lcm1 = d[0]

for i in d:

    lcm1 = lcm(lcm1,i)

ddays = lcm1


cd = [int(i) for i in input().strip().split('/')]

cyear ,cmonth,cdays = cd[0],cd[1],cd[2]



dc = [0,31,28,31,30,31,30,31,31,30,31,30,31]

dlc = [0,31,29,31,30,31,30,31,31,30,31,30,31]

        

rdict = {}

c = 0

for y in range(2015,2020+1):

    for m in range(1,13):

        if y%4==0:

            for d in range(1,dlc[m]+1):

                c+=1

                # print(c,':',y,m,d)

                rdict[c]=f'{y}/{m:0>2}/{d:0>2}'

        else:

            for d in range(1,dc[m]+1):

                c+=1

                # print(y,m,d)

                

                rdict[c]=f'{y}/{m:0>2}/{d:0>2}'


findkey =0

for k,v in rdict.items():

    if v=='2015/10/10':

        findkey = k

        # print(k,v)

print(rdict[findkey+ddays])


#4 

#4 5 12 21

#2015/10/10