kickstart Practice

https://code.google.com/codejam/contest/4374486/dashboard#s=p0
以后定个goal吧,除了最后一题的large case都尽量做出来

Problem A. GBus count
Problem B. Googol String
10^100是个幌子,k最大也就K ≤ 10^18

import sys
#file = 'test'
#file = 'small'
file = 'large'

ques = 'B'

res = []

def slove(k,n):
    reverse = 0
    while n!=1:
#        print(n)
        if k==n//2+1: return '0' if reverse%2==0 else '1'
        if k>n//2+1: 
            k=n-k+1
            reverse+=1
        n = n//2
    return '0' if reverse%2==0 else '1'
    
sys.stdin = open('%s-%s-practice.in'%(ques, file), 'r')
cases = int(input())
for i_ in range(cases):
    k=int(input())
    tt=1
    while tt<4*int(10**18):
        tt=2*tt+1
    res.append(slove(k,int(tt)))
    
fp = open('%s-%s-practice.out'%(ques, file), 'w')
for i_,c in enumerate(res):
    fp.write('Case #%d: %s\n'%(i_+1,c))

Problem C. Sort a scrambled itinerary
Problem D. Sums of Sums(TODO)

你可能感兴趣的:(kickstart Practice)