1from secret import clue
2
3
4def lucky():
5 result = 0
6
7 begin = clue(left_shift=5) >> 5
8 result |= begin
9
10 end = clue(right_shift=5) << 5
11 result |= end
12
13 mid1 = clue(bw_and=0b00010000) # bitmask with 16
14 if mid1 == 0:
15 result |= (0<<4)
16 else:
17 result |= (1<<4)
18
19 mid2 = clue(bw_or=0b11110111) # bitmask with 247
20 if mid2 == 0b11111111: # 255
21 result |= (1<<3)
22 else:
23 result |= (0<<3)
24
25 return result
.
----------------------------------------------------------------------
Ran 1 test in 0.004s
OK
| f | 1 | from secret import clue | f | 1 | from secret import clue |
| n | n | 2 | |||
| 2 | 3 | ||||
| 3 | def lucky(): | 4 | def lucky(): | ||
| 4 | result = 0 | 5 | result = 0 | ||
| 5 | 6 | ||||
| 6 | begin = clue(left_shift=5) >> 5 | 7 | begin = clue(left_shift=5) >> 5 | ||
| 7 | result |= begin | 8 | result |= begin | ||
| 8 | 9 | ||||
| 9 | end = clue(right_shift=5) << 5 | 10 | end = clue(right_shift=5) << 5 | ||
| 10 | result |= end | 11 | result |= end | ||
| 11 | 12 | ||||
| 12 | mid1 = clue(bw_and=0b00010000) # bitmask with 16 | 13 | mid1 = clue(bw_and=0b00010000) # bitmask with 16 | ||
| n | 13 | n | |||
| 14 | if mid1 == 0: | 14 | if mid1 == 0: | ||
| 15 | result |= (0<<4) | 15 | result |= (0<<4) | ||
| 16 | else: | 16 | else: | ||
| 17 | result |= (1<<4) | 17 | result |= (1<<4) | ||
| 18 | 18 | ||||
| 19 | mid2 = clue(bw_or=0b11110111) # bitmask with 247 | 19 | mid2 = clue(bw_or=0b11110111) # bitmask with 247 | ||
| t | 20 | t | |||
| 21 | if mid2 == 0b11111111: # 255 | 20 | if mid2 == 0b11111111: # 255 | ||
| 22 | result |= (1<<3) | 21 | result |= (1<<3) | ||
| 23 | else: | 22 | else: | ||
| 24 | result |= (0<<3) | 23 | result |= (0<<3) | ||
| 25 | 24 | ||||
| 26 | return result | 25 | return result |
| Legends | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
| |||||||||