From 72c4475754e34a9b94a47b2d7ad9c360cb127687 Mon Sep 17 00:00:00 2001 From: Javed Khan Date: Sat, 14 Apr 2012 18:25:28 +0530 Subject: [PATCH] init --- A-small-attempt0.in | 31 +++++++++++++++++++++++++++++++ A-small.out | 30 ++++++++++++++++++++++++++++++ A.py | 17 +++++++++++++++++ B-small-attempt0.in | 5 +++++ B.py | 31 +++++++++++++++++++++++++++++++ 5 files changed, 114 insertions(+) create mode 100644 A-small-attempt0.in create mode 100644 A-small.out create mode 100644 A.py create mode 100644 B-small-attempt0.in create mode 100644 B.py diff --git a/A-small-attempt0.in b/A-small-attempt0.in new file mode 100644 index 0000000..32bb7ec --- /dev/null +++ b/A-small-attempt0.in @@ -0,0 +1,31 @@ +30 +ejp mysljylc kd kxveddknmc re jsicpdrysi +rbcpc ypc rtcsra dkh wyfrepkym veddknkmkrkcd +de kr kd eoya kw aej tysr re ujdr lkgc jv +hello i am the google code jam test data +how are you +aynny iynny aynny iynny aynny iynny aynny iynny aynny iynny aynny iynny aynny iynny aynny ieeeeeeeee +y n f i c w l b k u o m x s e v z p d r j g a t h a q set k oset xa ynfd +schr rkxc tesr aej dksl tkrb xc +pklbr k wepler bcpc ks rbc dryrcd aej fymm kr y dyjdylc ks rbc xejrb +aej ncrrcp fjr rbc vkqqy ks wejp vkcfcd ncfyjdc kx ser bjslpa csejlb re cyr dkh +mcr mkvd ie tbyr bysid ie +bet ypc aej bemiksl jv ncfyjdc kx y veryre +kx fexxysicp dbcvypi ysi rbkd kd xa wygepkrc vpenmcx es rbc leelmc feic uyx +tbeeeeeeeeeeeeeeeeeeeyyyyyyyyy k oset f vmjd vmjd +cyfb ew jd byd bkd ets dvcfkym lkwr ysi aej oset rbkd tyd xcysr re nc rpjc +ysi kw aej iesr jsicpcdrkxyrc xc k tesr jsicpcdrkxyrc aej +rbkd bcpc kd ljsveticp yfrkgyrci rtcsra dcgcs fymkncp wjmm yjre se okfonyfo sykmrbpetksl xyabcx +aej tysr dcmm rbksld yr xc neksl qeeex +rbyso aej njr rbc pcym leelmcpcdc kd ks yserbcp fydrmc +set rbyr aej oset leelmcpcdc vmcydc ie ser jdc kr re byfo ksre ejp dadrcxd +k bygc ncdrci wpjkr dvkoc ysi xees set k dbymm ncdr aej rbc lja +xa syxc kd ijl k bygc ujdr xcr aej ysi k meeegc aej +aej vkddci eww rbc fbkfocs myia +rbkd kd de chfkrksl k bygc re le rbc nyrbpeex +na rbc vpkfoksl ew xa rbjxnd dexcrbksl tkfoci rbkd tya fexcd +eb acyb ympklbr tcpc lessy dbyoc kr jv tkrb rbc vypra ncyp resklbr +vscjxesejmrpyxkfpedfevkfdkmkfegemfysefeskedkd +w ew rte czjymd w ew esc czjymd esc +wep k ncrtccs rbpcc ysi s w ew k czjymd w ew k xksjd esc vmjd w ew k xksjd rte +ks y tepmi ew ikpctemgcd ysi mkesd dexcrkxcd rbc pypcdr fpcyrjpc kd y wpkcsi diff --git a/A-small.out b/A-small.out new file mode 100644 index 0000000..ec61ca0 --- /dev/null +++ b/A-small.out @@ -0,0 +1,30 @@ +Case #1: our language is impossible to understand +Case #2: there are twenty six factorial possibilities +Case #3: so it is okay if you want to just give up +Case #4: xoggk d yl wxo vkkvgo ekso uyl wonw sywy +Case #5: xkf yto akj +Case #6: yabba dabba yabba dabba yabba dabba yabba dabba yabba dabba yabba dabba yabba dabba yabba dooooooooo +Case #7: a b c d e f g h i j k l m n o p q r s t u v y w x y z now i know my abcs +Case #8: next time wont you sing with me +Case #9: right i forgot here in the states you call it a sausage in the mouth +Case #10: you better cut the pizza in four pieces because im not hungry enough to eat six +Case #11: let lips do what hands do +Case #12: how are you holding up because im a potato +Case #13: im commander shepard and this is my favorite problem on the google code jam +Case #14: whoooooooooooooooooooaaaaaaaaa i know c plus plus +Case #15: each of us has his own special gift and you know this was meant to be true +Case #16: and if you dont underestimate me i wont underestimate you +Case #17: this here is gunpowder activated twenty seven caliber full auto no kickback nailthrowing mayhem +Case #18: you want sell things at me boing zooom +Case #19: thank you but the real googlerese is in another castle +Case #20: now that you know googlerese please do not use it to hack into our systems +Case #21: i have bested fruit spike and moon now i shall best you the guy +Case #22: my name is dug i have just met you and i looove you +Case #23: you pissed off the chicken lady +Case #24: this is so exciting i have to go the bathroom +Case #25: by the pricking of my thumbs something wicked this way comes +Case #26: oh yeah alright were gonna shake it up with the party bear tonight +Case #27: pneumonoultramicroscopicsilicovolcanoconiosis +Case #28: f of two equals f of one equals one +Case #29: for i between three and n f of i equals f of i minus one plus f of i minus two +Case #30: in a world of direwolves and lions sometimes the rarest creature is a friend diff --git a/A.py b/A.py new file mode 100644 index 0000000..21e294b --- /dev/null +++ b/A.py @@ -0,0 +1,17 @@ +from string import maketrans + +x = {' ': ' ', 'a': 'y', 'c': 'f', 'b': 'n', 'e': 'c', 'd': 'i', 'g': 'l', 'f': 'w', 'i': 'k', 'h': 'b', 'k': 'o', 'j': 'u', 'm': 'x', 'l': 'm', 'o': 'e', 'n': 's', 'q': 'z', 'p': 'v', 's': 'd', 'r': 'p', 'u': 'j', 't': 'r', 'w': 't', 'v': 'g', 'y': 'a', 'x': 'h', 'z': 'q'} + +translation_table = maketrans(''.join(x.values()), ''.join(x.keys()), ) + + +num_of_lines = input() +lines = [] + +for i in range(num_of_lines): + line = raw_input() + lines.append(line) + + +for line_num, line in enumerate(lines, 1): + print "Case #%s: %s" % (line_num, line.translate(translation_table)) diff --git a/B-small-attempt0.in b/B-small-attempt0.in new file mode 100644 index 0000000..5a32452 --- /dev/null +++ b/B-small-attempt0.in @@ -0,0 +1,5 @@ +4 +1 9 +10 40 +100 500 +1111 2222 diff --git a/B.py b/B.py new file mode 100644 index 0000000..b1cc77c --- /dev/null +++ b/B.py @@ -0,0 +1,31 @@ +num_of_lines = input() +lines = [] + +for i in range(num_of_lines): + line = raw_input() + lines.append(line) + + +def process(line): + count = 0 + A, B = [int(x) for x in line.split()] + + for n in xrange(A, B): + s = str(n) + possibles = [j for j, i in enumerate(s[1:]) if int(i) <= int(str(B)[0])] + + for possible in possibles: + possible += 1 + p = s[possible:] + s[:possible] + + m = int(p) + + if A <= n < m <= B: + count += 1 + return count + +for line_num, line in enumerate(lines, 1): + + x = process(line) + + print "Case #%s: %s" % (line_num, x)