-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathD6-2.py
40 lines (39 loc) · 11 KB
/
D6-2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# 用手算的
# SAN: Branch 9: 86 + Branch 1: 50 --- YOU: Branch 1:166 + Branch 2: 103 + Branch 87: 1
# Ans = 86 + (166-50) + 103 + 1 - 2 = 304
# Stream from D6-1
Stream=[['COM', 'ML7', 'V6Q', 'TPY', '2YC', 'DLT', '6QR', 'DCX', 'TKM', '2J1', 'K8M', 'N95', '6LW', '212', '6GC', 'DZX', 'Q8F', 'PG7', 'VRY', 'PGG'], ['2YC', 'SX6', '3V2', 'QXF', 'J9W', '2YN', 'J4C', '6VX', '6LB', 'T9Z', 'LK4', 'QTF', 'ZVX', 'FHY', '7DC', 'M72', 'QP1', 'PND', 'GMR', 'QST', 'M2S', 'VDJ', 'JW4', '2WD', 'VKJ', 'VK5', '81Z', 'KNH', 'NT4', 'HG8', 'W8S', '2NH', 'RLJ', 'J5Q', '3WP', 'YKS', 'LLV', 'YSD', 'HLF', 'K7N', 'LPR', 'TRR', 'KJB', 'ZSW', '72R', 'Y1T', '2T7', '6VV', 'CN9', 'L7M', 'BC5', 'VXF', '19R', '62G', 'PHC', '96F', '5WS', '9L3', 'SM3', 'ZL3', 'JP5', 'GVG', '9WV', 'HCT', '9KC', '46N', 'S2D', 'DGZ', 'M17', '9J6', 'CY6', 'L5B', 'J9C', 'G9P', 'VLT', '1WZ', '319', 'WC6', 'LXZ', 'CYZ', 'KN5', 'XBH', '4WD', '3J1', 'TP4', 'BW5', 'RXF', 'BXW', '1YY', 'G8R', 'M3R', '8JW', 'CCB', 'B29', '8R7', '7FB', 'XZN', 'CGQ', 'PFF', '4LD', '4GV', 'Z17', '4ZD', 'B3C', 'KGS', 'HHN', 'WH4', 'ZBK', 'PVD', '6RF', 'NPC', 'TQP', '8NV', 'FSB', 'PK7', 'H6P', '6TT', '183', 'PQF', 'NXF', '5B3', 'LVZ', 'P98', '9SF', 'R6Y', 'XJM', 'PHF', '1YT', '1JF', 'NNH', '65Y', 'P5P', '3HG', 'GHN', '5DM', '2WF', 'LS2', 'Q4D', 'JBS', 'GK1', 'MSN', 'W3D', '8S7', 'XDD', 'G9R', 'BCV', '6TZ', 'Q8J', 'YJQ', 'XN6', '113', 'Q29', 'BZD', 'XQF', 'HXM', 'GX7', 'YLK', 'X5V', 'RZ8', 'FGY', '61Z', 'YH9', 'MGY', 'K95', 'DY2', 'CM5', 'V9P', '248', 'XVV', 'DM6', '9NJ', 'RMB', 'VKX', 'C2Q', 'LDB'], ['V9P', 'B98', 'YVB', 'P7K', 'DXN', 'KVH', 'VQ7', '3NY', '1FX', 'Z6S', 'BJK', 'SKV', 'YWS', 'Q8X', 'SMJ', 'PC3', 'YMB', '484', '8YR', '677', 'G3Q', 'R21', 'F5V', '4QJ', '6VW', '1FS', 'DQ4', 'X34', 'WSY', 'X5R', 'GFG', '8Z8', 'SXQ', 'G7N', 'YC8', 'XS1', 'RGV', 'V9J', 'P5X', 'M8C', '6XD', 'Y1S', 'DC6', '4W5', 'R1J', '53D', 'MCW', 'LRD', 'JNY', 'F9R', 'R66', '8DH', 'JRF', 'M9R', 'NJB', 'VK9', '45G', 'P3N', 'P8C', 'CTR', '771', 'WY2', '487', 'T2N', '8N7', 'FDY', 'GT6', 'J29', 'K9P', 'RQX', '94S', 'VX4', '9FL', 'X5Q', '61X', 'JN5', 'KD8', 'RKH', 'WZ7', 'J4Q', 'FR3', 'W19', 'PFH', '1J9', 'X92', '1M4', 'SJM', '68L', 'BJ7', 'R2J', '2V2', 'C9S', 'NYS', '9B4', '7ZX', '2BN', 'LM7', 'S4B', '3SG', 'RFG', 'TKV', 'BPX', 'TBN', '6KQ', 'ZQY', 'Y8L', '6C2', 'Y9Z', 'CNZ', 'L7X', 'SKG', '11M'], ['VQ7', '747', 'QXY', 'TVB', 'G1F', 'F4Y', 'WKR', 'M3F', 'QF7', 'G93', '6KZ', 'F1H', 'WHH'], ['WSY', '5M5', 'Y6C', 'LC7', '7SS', 'T6V', 'X8G', 'YLS'], ['2T7', 'X5H', '2L2', '64M', '4TV', '93R', '6TD', 'HXG', 'HWS', 'P13', 'T4G'], ['G9P', 'ZSM', '6LC', 'LPL', 'WP5', '3L6', '4W3', 'GYK'], ['9FL', 'DPR', '318', 'M4B', '7T6', 'PRP', '9GB', 'GSF', 'PD9', 'TYR', 'JXJ', '7S8', 'M83', 'FRY', 'VLW', 'JPQ', 'FFS', 'QNC', 'B2B', 'TDW', 'SDV', '5T7', 'Z5Y', '4N7', '7W3', 'NMG', 'TJ2', 'WKB'], ['G7N', 'RZP', 'NGS', '72D', 'BLC', 'DCK', 'D65', '4N3', 'LHM', 'RB8', 'GGX', '4R2'], ['BC5', 'CYJ', '7XL', 'GCH', '9SD', 'XFM', 'R2N', '8CJ', '5QS', 'HQR', 'L4D', 'PQ7', 'XLV', '1CM', 'HYW', '24B', 'VV9', '4Z9', '2BL', 'PX9', 'SR5', 'SQZ', '5VV', '5P5', 'BK8', 'B5S', 'FX6', 'NYD', 'T3V', '4B7', 'NFC', 'DYG', '3FP', 'DKW', 'M3J', '9DP', '9DX', 'Y3V', 'L73', '1XV', '19K', 'C7H', 'JFB', 'CMF', 'D5N', '5B5', 'DTY', 'WGQ', '18Y', 'V17', '4QM', '6B2', 'D5V', 'CJ1', 'NL1', 'QHY', 'G43', '17T', 'XNK', 'NHX', 'YYH', '62H', '5D3', '97R', '9HM', '979', '83S', 'TH4', 'X26', 'KNT', '5FZ', 'M5M', 'MJ7', 'STL', 'C7Q', 'MJC', '52Z', 'T7V', '7C5', '351', 'ZCK', 'TZJ', '5QJ', 'HHB', 'RWF', 'HGN', 'SAN'], ['TDW', 'VW5', 'CK9', '1L1', 'VH4', 'T75', 'SJJ', 'YC6', '6K5', 'JRS', '8D1', '8QG', '55L', '3Z1', '2XW', 'R2P', 'MWX', 'B17', '779', '4RY', 'Z6H', 'JYB'], ['3FP', 'BVD', 'Z5M', 'QHT', '8K3', 'YCL', 'KGL', '44W', 'FGB', 'YT6', 'DXZ', '39Y', 'CMK', 'P3C', '2P7'], ['6XD', 'P7W', 'VSK', 'THY', '2JN', 'VQW', 'KD6'], ['6VW', 'X6C', 'TSV', '1LV', 'GFH', 'N6Q', 'GBK', '8HV', 'ZBW', 'ZYN', 'ZQ2'], ['H6P', '5RQ', 'PBN', 'G77', 'QG1', '125', 'Q61', '38H', '6L2', 'WW5', 'LZC', '5R2', '2LS', 'QS5', 'RRM', 'L3N'], ['3Z1', 'L7Y'], ['1LV', 'QCF', 'G3S', 'HCZ', '1X4', 'QP9', 'JNR', '8YP', 'L2L', '9FZ', '8PH', 'C4N', 'RHS', 'GBD', 'HZJ', 'WFK', 'HXC', 'GX8', 'KCS', 'XDX', 'D91'], ['2BN', 'DR1', 'L88', '8CF', 'RPP', '7ZT', '9M8', 'NQ5', '6K4', '6N7', '868'], ['LC7', 'JBF', 'SZC', 'S7Y', '6DR', 'HH7', '5LZ', 'BZ3', 'V9W', 'VZ8', 'W81', '3XX', 'D1H', 'TTT', 'PZ7', '4FZ'], ['6LC', 'RZB', 'Q92', 'GRR', 'C1N', 'PRZ', '6J4', 'JS4', 'MS6', 'V4N', 'FWT', 'TKC', '76M', '2V4', '79M', '2S5', 'RBB', 'Y34', 'VG6', 'W38', '2RS', 'T8Y', 'X6T', 'T37'], ['TVB', 'KLB', '31Z', 'TCV', 'H9P', 'G1N'], ['6RF', 'G42', '672', 'WDN', '7FF', '597', 'H8Q', 'Z1Q', 'QCV', '2JP', '2G8', '8K1'], ['X5R', '8C4', 'DRX', '69N', 'W4Y', 'YCF', 'VY4', 'W52', '262', 'J28', 'M8L', 'W33', '7MB', '1RF', 'V2S', 'QWW', '849'], ['VY4', 'YSL', 'LP1', 'KBR', 'B16', 'WSR', '98S'], ['6DR', '3KD', 'X65', 'RPG', 'CQP', 'LW3', '1P2', '1S4', 'VZX', '681', 'BBL', 'D5Q'], ['LVZ', 'GY6', '1ZW', 'WKN', 'NXN', 'XT1', 'W5Q'], ['THY', 'Y85', 'X68', '1RB', 'YPZ', 'PMJ', 'N2Y', 'D8V'], ['VQW', '2V7', '9LV', 'RSN', 'VCJ', 'XSQ', 'GYL', 'HMG', '53T', 'H97', 'XL2', 'PMC'], ['YC8', 'HZ2', 'J3B', 'VGZ', 'SYR', 'XZ3', 'X5T'], ['9J6', 'MYL', 'HL8', 'G1B', 'KDN', 'R6Z', 'KQ1', 'H3P', 'H16'], ['CQP', '5PJ', 'W68', 'KQ5', 'YV4'], ['747', 'BSB', 'H4G', 'NCN', '3FL', 'QTP', 'M5Q', '4M1', '9D8'], ['GK1', 'DQM', 'K3X', 'CZJ', 'H7C', 'WXV', 'BH6', 'MF4', '7GN', 'P6R'], ['HL8', 'DMB', 'FTV', '67N', 'JSN', 'LR3', 'P6X', '8Z1', 'KVB', '1Y5'], ['PD9', 'YNJ', '3HK', '1W4', 'JZ4', '6C5', 'NF5', 'TBK'], ['XLV', '47R', 'L7S', '37K', '1Q4', 'FDD', '6KP', 'GJB', 'LWK', 'MZG'], ['VG6', 'YLW', '1QS', '4D5', '1N9', 'HSV', 'LPD', '5MG', 'Y8Q', 'H2X'], ['9WV', 'K1T', 'J6S', 'HKF', 'VNR', 'WJ4', 'SGB', 'HTX', '9RN', 'QYV', 'RLB', 'QQR', 'YQN', '12D', 'F9B', 'CKC', 'JC3', 'VR5', 'NH5', 'V2Y', 'X86'], ['53D', 'G7C', '8SK', 'CM2', 'Q2J', '96V', 'F1D', 'J71', 'B2H', 'NF2', 'WB6', 'NKK', 'DGX', 'LWC', 'ZJV', '346', 'Q8Q'], ['PZ7', 'BWK', '8RJ', 'MZ1', '1YN', 'MHG', 'C7W'], ['WFK', '759', 'MMJ', 'YL1', 'NDK', 'D1V', 'MJK', 'Y55', 'X9J', '2CL'], ['JNR', 'BJL', 'PFS', 'JYG', 'LTF', '4GZ', 'N9R', 'ZZ3', 'F17', 'SH3'], ['G1F', '5VN', 'QQP', '1F7', 'DXR', '8FJ', 'JF9', '9H3', 'PYN', 'KJN', 'PJJ', 'YZ4'], ['TH4', 'XZV', '4S5', '6V7', '1Z7', 'HT1', '54V'], ['9SD', 'FRH', '81J', '573', 'HZC', 'F4H', '8C7'], ['JSN', 'P6K', 'G72', 'QW7', 'LQ8', '5JM', 'Y2L', 'C57', 'GRT', 'S8N', 'Y7G', 'H3Z', 'BDJ', '7XM', 'YNQ', 'QW9', '7HW', 'GTK', 'RYG', 'X9R', 'RKS', 'BQ9'], ['ZL3', '114', '9VC', 'LFC', '43Y', 'QKM', 'CMJ', 'VMQ', 'WZ1'], ['M83', 'FPF', 'F3R', 'GC3', 'RZR', 'GH3', 'TG5', 'GQB'], ['2V4', 'VX3', '49Z', 'CCM', 'L2Z'], ['QW9', '4P5', 'W26', 'ZTN'], ['TKC', 'ZQD', 'PMY', 'QJM'], ['P98', 'Y3Z', 'Q7M', 'JRV', 'NF8', '577', '755'], ['QXY', 'MFG', 'FPQ', 'QKH', 'L5N', 'K1Y', '2ZR'], ['YNJ', 'RHQ', 'XZ6', '91R', 'LPG', 'XPL', 'QVR', 'WB1', 'DFR'], ['GVG', 'WY9', 'XKN', 'LT7', 'ZZM', '9RW', 'JC7', 'K7H', '5J7'], ['JPQ', 'VHY', 'BG7', '8NQ'], ['5VN', 'NFR', 'PCV', 'N9X', '9KT'], ['DXZ', 'FNG', 'RTR', 'J8P', 'J5G', 'N4K'], ['Q92', '5DK', 'FLZ', 'TZP', 'MK5', 'SC7', 'DY9', '8ZZ', 'L16', '7VX'], ['T75', '5YF', 'RFL', 'KPR', 'WCJ', '2B4', '5MV', 'J5W', '72Z'], ['HCZ', 'HVV'], ['P5P', '6VT', 'YPR', '3ZK', 'RSW', 'RQ6', '9SW'], ['X5Q', 'YCT', '6RT', 'FGN', 'JMN', 'BX6', '397', '5H2', '33S'], ['CMF', '1G1', 'TDL', 'W6W', 'NNX', 'B66'], ['H4G', 'M3V', '1QC', 'QDC', 'MBT', 'TBD', '2YQ', 'W1M'], ['F1D', 'M29', 'P8K', 'K51', 'SVQ', 'MJD', 'Y9L', '2P6'], ['DXR', 'CTS', 'YFG', 'CRC', 'VBT'], ['SM3', '595', 'PNH', 'KYQ', 'BY7', '8M9', '2P8', '9BZ', 'W4G', 'NTH'], ['X68', 'ZV4', 'ZLV', 'VS8', 'J81', 'XJS'], ['JYG', 'NN1', '1X7', 'CP9', 'XC7', '48H'], ['S8N', 'YT5', 'CGG', 'D7H', 'D3K', '4FG', 'LVB', 'ZWS'], ['P6K', 'G14', 'QX9', '72M', 'F1F', '7YW', '1RM'], ['7S8', 'Y82', 'WJS', '6JT', 'BR1'], ['NKK', 'DK2', 'N41'], ['YT5', 'CKS', 'ST1'], ['7ZT', 'MM2', 'MDX', 'LPZ'], ['CCB', 'BTN', 'Q91', 'FNR', 'WS8', '6KF', 'LNJ'], ['7XM', 'MK1', 'T7W', 'TVF'], ['VCJ', '8GM', 'LCC'], ['1L1', 'DK1', 'Z16', 'FF6', 'PSW', 'FRD', 'ML8', 'B9J'], ['WDN', 'WYX', 'RSC', '6DT'], ['FTV', '28F', '8NM', 'D43'], ['5YF', 'X56', '19Y', '2BG', 'VLB', '6S1'], ['CN9', 'VFJ', '2RN', 'BDK', '3C3', 'Y7Y', 'L67'], ['QP9', '711', 'QYM', 'LDX'], ['VK9', 'ZZB', 'YG3', 'V1F', 'GDQ', 'BCW', '7PY', '74M'], ['CGG', '38V', 'T1Q', 'LWG', '4HR', 'LX9'], ['6KQ', 'YOU'], ['DRX', 'YDY', 'NWQ', 'NN3'], ['YLW', 'Q3P', 'MSM'], ['BLC', 'C31'], ['KGL', 'DP8'], ['LFC', 'JKP', 'M15'], ['B2H', 'HMK']]
Bplus1CL=0
for first_item in range(len(Stream)): # to find the 1st item in new Branch
if 'YOU' in Stream[first_item]:
print('YOU are at stream',first_item,'at position',Stream[first_item].index('YOU'))
BYitself=int(Stream[first_item].index('YOU'))
Bplus1CL+=BYitself
connectorY=Stream[first_item][0] # the connector in new branch
for Ylist in range(len(Stream)):
if connectorY in Stream[Ylist]: # to find the number of the connected Branch
if first_item!=Ylist: # YOU is at branch 9 (position 86), connected to 1(position 50),0
print('ConnectorY in stream',Ylist,'is at position',Stream[Ylist].index(connectorY))
ConnectL=(int(Stream[Ylist].index(connectorY))+1)# +1 for connection zone
Bplus1CL+=ConnectL
print('The Brief sum of forward connected Branch1',Bplus1CL)
for Ylist1 in range(len(Stream)):
connectorY1=Stream[Ylist][0]
if connectorY1 in Stream[Ylist1]: # to find the number of the connected Branch
if first_item!=Ylist1: # YOU is at branch 9 (position 86), connected to 1(position 50),0
print('ConnectorY1 in stream',Ylist1,'is at position',Stream[Ylist1].index(connectorY1))
ConnectL=(int(Stream[Ylist1].index(connectorY1))+1)# +1 for connection zone
Bplus1CL+=ConnectL
print('The Brief sum of forward connected Branch1',Bplus1CL)
elif 'SAN' in Stream[first_item]: # SAN is at branch 87 (position 1), connected to 2 (position 103),1 (position 166),0
print('Santa is at stream',first_item,'at position',Stream[first_item].index('SAN'))
BSitself=int(Stream[first_item].index('SAN'))
Bplus1CL+=BSitself
connectorS=Stream[first_item][0] # the connector in new branch
for Slist in range(len(Stream)):
if connectorS in Stream[Slist]: # to find the number of the connected Branch
if first_item!=Slist: # YOU is at branch 9 (position 86), connected to 1(position 50),0
print('ConnectorS in stream',Slist,'is at position',Stream[Slist].index(connectorS))
ConnectL=(int(Stream[Slist].index(connectorS))+1)# +1 for connection zone
Bplus1CL+=ConnectL
print('The Brief sum of forward connected Branch',Bplus1CL)