# Commits

committed ce31f6f

Code jam: Alien problem done

• Participants
• Parent commits 564a9e9
• Branches default

# File codejam/alien.py

+#!/usr/bin/env python
+
+f = open('input.txt', 'r+')
+
+tmp = tmp.split(' ')
+tmp = [int(x) for x in tmp]
+length, size, cases = tmp[0], tmp[1], tmp[2]
+words = []
+
+for n in range(0, size):
+
+word = words[:]
+for n in range(0, cases):
+    pos = 0
+    possible = word[:]
+    x = 0
+    first = True
+    while x < len(case):
+        if first:
+            possible = word[:]
+            first = False
+        else:
+            possible = list(words)[:]
+        words = set([])
+        if case[x] == '(':
+            x += 1
+            while case[x] != ')':
+                letter = case[x]
+                for w in possible:
+                    if w[pos] == letter:
+                x += 1
+            x += 1
+        else:
+            for w in possible:
+                if w[pos] == case[x]:
+
+            x += 1
+        pos += 1
+
+    print "Case #" + str(n+1) + ":", len(words)

+Case #1: 0
+Case #2: 1
+Case #3: 0
+Case #4: 1
+Case #5: 6
+Case #6: 7
+Case #7: 1
+Case #8: 8
+Case #9: 1
+Case #10: 8

# File problem132.py

#!/usr/bin/env python

from primes import primes
+from tmp import p
+
+primes += p

def primefact(num):
count = 0
if count >= 40:
break
pr = primes[p]
-        print pr
if pr/2 > num:
break
elif num%pr == 0:
pfact.append(pr)
num = num/pr
+            count += 1
+            print count, p, pr
p = 0
-            count += 1
-            print count
+
+
else:
p += 1

if __name__ == '__main__':
num = ''
-    for x in xrange(1, 10**9 + 1):
+    for x in xrange(1, 100):
num = num + '1'

num = int(num)
-    print num
print primefact(num)