Select Page

Some short/fast solutions to CodeChef January Long Challenge 2019 Div 2

Problem name: Fancy Quotes (FANCY)

```for _ in xrange(input()):
print "Real Fancy" if "not" in raw_input().split() else "regularly fancy"
```

Problem name: Lucky Number Game (HP18)

```for _ in xrange(input()):
N,a,b = map(int, raw_input().split())
if a==b: raw_input(); print "BOB"
else:
bob=alice=0
for Ai in map(int, raw_input().split()):
if Ai % a == 0: bob+= 1
elif Ai % b == 0: alice+= 1
print "BOB" if bob>alice else "ALICE"
```

Problem name: Chef and Modulo Game (DPAIRS)

```n,m = map(int, raw_input().split())
d = map(int, raw_input().split())
a = d.index(max(d))
d = map(int, raw_input().split())
b = d.index(min(d))
for i in xrange(m):
print a, i
for i in xrange(n):
if i != a: print i, b
```

Problem name: Chef and Modulo Game (MGAME)

```for _ in xrange(input()):
n,p = map(int,raw_input().split())
if n<3: print pow(p,3)
else:
c = (n-1)/2
print (p-n)*(p-n) + (p-c)*(p-c) + (p-n)*(p-c)
```

Problem name: A Pizza Slice (XYPIZQ)

```from fractions import gcd
for _ in xrange(input()):
nx, t, x, y, z = map(int, raw_input().split())
d = 2*nx+1
n = 2*(nx-y+1)-1 if t%2==0 else (x if x==z else d-(z if t==1 else x))
gcf = gcd(n, d)
print n/gcf, d/gcf
```

Problem name: Yet Another Problem About Sequences (EARTSEQ)

```A=[]; C=[]
for a,b in zip(range(11,75100,6),range(13,75100,6)):
A+=[2*a, 3*a, 3*b, 2*b]
C+=[2*b, 3*b, 3*(b+4), 2*(a+6)]
N = [0]*4
N[0] = [6,15,35,14] + A
N[1] = [6,15,35,77,22] + C
N[2] = [6,15,35,77,143,26] + A[4:]
N[3] = [6,10,15,21,14] + A
for _ in xrange(input()):
n = input()
print ' '.join(map(str, N[n%4][:n]))
```