Browse Source

day19p2

master
mid-kid 6 years ago
parent
commit
a85f5cf60f
  1. 8
      day19p2/Makefile
  2. 61
      day19p2/input
  3. 13
      day19p2/main.c

8
day19p2/Makefile

@ -0,0 +1,8 @@
CFLAGS := -O3 -Wall -Wextra -std=c17 -D_GNU_SOURCE
.PHONY: all
all: main
.PHONY: clean
clean:
rm -f main

61
day19p2/input

@ -0,0 +1,61 @@
#ip 3
#reg0=1
; fn main()
; &1 = ((&1 + 2) ** 2) * 19(&3) * 11 = ((&1 + 2) ** 2) * 209
; &2 = ((&2 + 2) * 22(&3)) + 20 = &2 * 22 + 64
; &1 = &1 + &2
; if (&0 != 0) {
; &2 = ((((27(&3) * 28(&3)) + 29(&3)) * 30(&3)) * 14) * 32(&3) = 10550400
; &1 = &1 + &2
; &0 = 0
; }
; &5 = 1
; do {
; &4 = 1
; do {
; if (&5 * &4 == &1) {
; &0 = &0 + &5
; }
; &4 = &4 + 1
; } while (&4 <= &1)
;
; &5 = &5 + 1
; } while (&5 <= &1);
00: addi 3 16 3
01: seti 1 9 5
02: seti 1 1 4
03: mulr 5 4 2
04: eqrr 2 1 2
05: addr 2 3 3
06: addi 3 1 3
07: addr 5 0 0
08: addi 4 1 4
09: gtrr 4 1 2
10: addr 3 2 3
11: seti 2 3 3
12: addi 5 1 5
13: gtrr 5 1 2
14: addr 2 3 3
15: seti 1 4 3
16: mulr 3 3 3
17: addi 1 2 1
18: mulr 1 1 1
19: mulr 3 1 1
20: muli 1 11 1
21: addi 2 2 2
22: mulr 2 3 2
23: addi 2 20 2
24: addr 1 2 1
25: addr 3 0 3
26: seti 0 4 3
27: setr 3 9 2
28: mulr 2 3 2
29: addr 3 2 2
30: mulr 3 2 2
31: muli 2 14 2
32: mulr 2 3 2
33: addr 1 2 1
34: seti 0 6 0
35: seti 0 0 3

13
day19p2/main.c

@ -0,0 +1,13 @@
#include <stdio.h>
int main()
{
unsigned r0 = 0;
unsigned r1 = 10551300;
for (unsigned r5 = 1; r5 <= r1; r5++) {
if (r1 % r5 == 0) {
r0 = r0 + r5;
}
}
printf("%d\n", r0);
}
Loading…
Cancel
Save