Initial commit
This commit is contained in:
commit
49459d2bc6
3 changed files with 23 additions and 0 deletions
11
README.md
Normal file
11
README.md
Normal file
|
@ -0,0 +1,11 @@
|
|||
# golfathon
|
||||
|
||||
Welcome to our code golf hackathon! You can either create new hackathon problems or answer existing ones. Have fun!
|
||||
|
||||
## Create
|
||||
|
||||
To create a new problem, make a folder named after the problem and write the problem statement in the `README.md` inside the folder. See `pund/README.md` for an example.
|
||||
|
||||
## Answer
|
||||
|
||||
Write your answer to a problem in the a file named using your username in the problem's folder. Preferably, your program should run in a reasonable amount of time and not access the internet.
|
5
pund/README.md
Normal file
5
pund/README.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
# pund
|
||||
|
||||
Define *pund numbers* as positive integers that look the same when rotated 180 degrees. 212 and 6699 are pund numbers while 17071 is not. More specifically 0, 1, 2, 5, and 8 are defined to be unchanged by a 180 degree rotation, while 6 after the rotation becomes a 9 and vice versa.
|
||||
|
||||
Your task is to write a program that takes in a positive integer `k` as an input and outputs the `k`th pund number.
|
7
pund/a.py
Normal file
7
pund/a.py
Normal file
|
@ -0,0 +1,7 @@
|
|||
import sys
|
||||
c=int(sys.argv[1])
|
||||
i=0
|
||||
while c:
|
||||
i+=1
|
||||
c-=list(str(i))[::-1]==list(map(lambda j:'012xx59x86'[ord(j)-48],str(i)))
|
||||
print(i)
|
Loading…
Reference in a new issue