Phil 4 gadi atpakaļ
vecāks
revīzija
3ea90e2e51
2 mainītis faili ar 128 papildinājumiem un 0 dzēšanām
  1. 101 0
      10/input.txt
  2. 27 0
      10/main.py

+ 101 - 0
10/input.txt

@@ -0,0 +1,101 @@
+144
+10
+75
+3
+36
+80
+143
+59
+111
+133
+1
+112
+23
+62
+101
+137
+41
+24
+8
+121
+35
+105
+161
+69
+52
+21
+55
+29
+135
+142
+38
+108
+141
+115
+68
+7
+98
+82
+9
+72
+118
+27
+153
+140
+61
+90
+158
+102
+28
+134
+91
+2
+17
+81
+31
+15
+120
+20
+34
+56
+4
+44
+74
+14
+147
+11
+49
+128
+16
+99
+66
+47
+125
+155
+130
+37
+67
+54
+60
+48
+136
+89
+119
+154
+122
+129
+163
+73
+100
+85
+95
+30
+76
+162
+22
+79
+88
+150
+53
+63
+92

+ 27 - 0
10/main.py

@@ -0,0 +1,27 @@
+file = open('input.txt','r')
+
+tmp = file.readlines()
+data = []
+data.append(0)
+for t in tmp:
+    data.append(int(t.replace('\n','')))
+
+data.sort()
+
+onejolt = 1
+threejolt = 1
+
+
+print(data)
+
+for d in range(1,len(data)-1):
+    if data[d] - data[d-1] == 1:
+        onejolt += 1
+
+    if data[d] - data[d-1] == 3:
+        threejolt += 1
+    print('1 jolt: ' + str(onejolt))
+    print('3 jolt: ' + str(threejolt))
+    print(str(data[d-1]) + ' ---('+str(data[d] - data[d-1])+')---> '+str(data[d]))
+
+print(onejolt * threejolt)