コード例 #1
0
 def test_ex(self):
     adjacency = {
         0: [2],
         1: [1],
         2: [0, 3, 4],
         3: [2, 4],
         4: [2, 3, 6],
         5: [6],
         6: [4, 5]
     }
     self.assertEqual(target.calc(adjacency), 2)
コード例 #2
0
 def test_ex(self):
     from sets import Set
     initial = Set()
     initial.add((-1, 0))
     initial.add((1, 1))
     self.assertEqual(target.calc(initial, 0, True), 0)
     self.assertEqual(target.calc(initial, 1, True), 0)
     self.assertEqual(target.calc(initial, 2, True), 0)
     self.assertEqual(target.calc(initial, 6, True), 0)
     self.assertEqual(target.calc(initial, 7, True), 1)
     self.assertEqual(target.calc(initial, 100, True), 26)
     self.assertEqual(target.calc(initial, 10**7), 2511944)
コード例 #3
0
 def test_example(self):
     example = []
     pbga = target.Node('pbga', 66)
     xhth = target.Node('xhth', 57)
     ebii = target.Node('ebii', 61)
     havc = target.Node('havc', 66)
     ktlj = target.Node('ktlj', 57)
     cntj = target.Node('cntj', 57)
     qoyq = target.Node('qoyq', 66)
     jptl = target.Node('jptl', 61)
     gyxo = target.Node('gyxo', 61)
     fwft = target.Node('fwft', 72, [ktlj, cntj, xhth])
     padx = target.Node('padx', 45, [pbga, havc, qoyq])
     ugml = target.Node('ugml', 68, [gyxo, ebii, jptl])
     tknk = target.Node('tknk', 41, [ugml, padx, fwft])
     self.assertEqual(target.calc(tknk), 60)
コード例 #4
0
 def test_example(self):
     lines = [
         'b inc 5 if a > 1', 'a inc 1 if b < 5', 'c dec -10 if a >= 1',
         'c inc -20 if c == 10'
     ]
     self.assertEqual(target.calc(target.parse(lines)), 10)
コード例 #5
0
 def test_example_3(self):
     self.assertEqual(target.calc('<<<<>'), 3)
コード例 #6
0
 def test_ex_1(self):
     self.assertEqual(target.calc(['ne', 'ne', 'ne']), 3)
コード例 #7
0
 def test_example_1(self):
     self.assertEqual(target.calc([]), 'a2582a3a0e66e6e86e3812dcb672a272')
コード例 #8
0
 def test_800(self):
     self.assertEqual(gold.calc(800), 806)
コード例 #9
0
 def test_1(self):
     self.assertEqual(gold.calc(1), 2)
コード例 #10
0
 def test_4(self):
     self.assertEqual(gold.calc(4), 5)
コード例 #11
0
 def test_10(self):
     self.assertEqual(gold.calc(10), 11)
コード例 #12
0
 def test_ex(self):
     self.assertEqual(target.calc(65, 8921, 5 * 10**6), 309)
     pass
コード例 #13
0
 def test_2(self):
     self.assertEqual(gold.calc(2), 4)
コード例 #14
0
 def test_ex(self):
     dance = ['s1', 'x3/4', 'pe/b']
     self.assertEqual(target.calc(dance, 5, 1), 'baedc')
     self.assertEqual(target.calc(dance, 5, 2), 'ceadb')
コード例 #15
0
 def test_3(self):
     dance = \
     's10,x5/9,s15,x3/4,s8,x15/0,s4,x6/11,pl/e,x15/10,s10,x2/8,s1,x15/0,s12,pa/o,x9/8,pi/f,s1,x6/5,s1,x3/9,pl/n,x4/8,pg/a,x10/12,s8,x7/1,pn/d,s8,x4/14,s2,x7/6,s10,x11/8,s9,x4/12,s7,x1/9,po/m,x11/13,s9,pc/d,x0/1,s4,x8/11,pi/e,x2/0,pg/a,x9/5,s7,x0/3,s9,x5/9,s5,x15/14,pb/c,x8/12,s11,x10/6,pl/h,x5/3,s9,x15/0,s5,x3/5,s9,x0/12,s9,x2/6,s5,x8/10,pj/c,s13,x12/11,pf/a,s7,pn/m,x9/1,s15,x4/6,pe/j,x15/3,s6,x0/12,s7,x2/7,pn/c,x9/11,s9,x15/1,pp/l,x0/14,s14,x5/8,s10,x3/14,s13,x9/7,s7,x6/11,s14,x8/12,pn/m,x7/4,ph/o,x14/11,s4,pc/k,x4/12,s7,x5/15,pd/e,x2/9,s11,x14/4,s2,x7/12,pm/f,x11/4,s1,x10/5,s11,x4/15,pp/l,x8/13,pj/n,x9/15,po/k,s2,x12/14,pm/a,x9/10,s3,x13/5,s13,x0/9,s3,x5/8,s13,pg/k,x13/2,s11,x0/6,s7,x9/14,s8,pj/i,x3/1,s15,x2/11,po/c,x7/5,pg/l,x13/9,pn/m,x2/7,s5,x11/1,s13,x8/2,pd/l,x14/13,s9,x2/4,s10,x12/6,pm/b,x14/13'.split(',')
     self.assertEqual(target.calc(dance, 16, 5001), 'midgneohckafjlpb')
コード例 #16
0
 def test_2(self):
     dance = ['s1', 'x3/4', 'pe/b']
     self.assertEqual(target.calc(dance, 16, 2001), 'klmdnopaecbfghij')
コード例 #17
0
 def test_example_2(self):
     self.assertEqual(target.calc([ord(c) for c in 'AoC 2017']),
                      '33efeb34ea91902bb2f59c9920caa6cd')
コード例 #18
0
 def test_ex2(self):
     layers = {0: 3, 1: 2, 4: 4, 6: 4}
     self.assertEqual(target.calc(layers), 10)
コード例 #19
0
 def test_3(self):
     self.assertEqual(gold.calc(3), 4)
コード例 #20
0
 def test_example_4(self):
     self.assertEqual(target.calc('<{!>}>'), 2)
コード例 #21
0
 def test_9(self):
     self.assertEqual(gold.calc(9), 10)
コード例 #22
0
 def test_example_6(self):
     self.assertEqual(target.calc('<{o"i!a,<{i<a>'), 10)
コード例 #23
0
 def test_140(self):
     self.assertEqual(gold.calc(140), 142)
コード例 #24
0
 def test_example_1(self):
     self.assertEqual(target.calc('<>'), 0)
コード例 #25
0
 def test_0(self):
     self.assertEqual(gold.calc(0), 1)
コード例 #26
0
 def test_example_2(self):
     self.assertEqual(target.calc('<random characters>'), 17)
コード例 #27
0
 def test_ex_4(self):
     self.assertEqual(target.calc(['se', 'sw', 'se', 'sw', 'sw']), 3)
コード例 #28
0
 def test_example(self):
     self.assertEqual(target.calc([0, 3, 0, 1, -3]), 10)
コード例 #29
0
 def test_ex_2(self):
     self.assertEqual(target.calc(['ne', 'ne', 'sw', 'sw']), 2)
コード例 #30
0
 def test_example_4(self):
     self.assertEqual(target.calc([ord(c) for c in '1,2,4']),
                      '63960835bcdc130f0b66d7ff4f6a5a8e')