소스 검색

Solved part1

Piotr Czajkowski 4 일 전
부모
커밋
3da574a000
2개의 변경된 파일7개의 추가작업 그리고 3개의 파일을 삭제
  1. 2 3
      17/code.go
  2. 5 0
      17/input

+ 2 - 3
17/code.go

@@ -103,10 +103,9 @@ func process(registers []Register, program []int) []int {
 		case 5:
 			results = append(results, getCombo(program[instructionPointer+1], registers)%8)
 		case 6:
-			registers[1].value = registers[0].value / (getCombo(program[instructionPointer+1], registers) * getCombo(program[instructionPointer+1], registers))
+			registers[1].value = registers[0].value / (powerOfTwo(getCombo(program[instructionPointer+1], registers)))
 		case 7:
-			registers[3].value = registers[0].value / (getCombo(program[instructionPointer+1], registers) * getCombo(program[instructionPointer+1], registers))
-
+			registers[2].value = registers[0].value / (powerOfTwo(getCombo(program[instructionPointer+1], registers)))
 		}
 
 		instructionPointer += 2

+ 5 - 0
17/input

@@ -0,0 +1,5 @@
+Register A: 22817223
+Register B: 0
+Register C: 0
+
+Program: 2,4,1,2,7,5,4,5,0,3,1,7,5,5,3,0