From 2c8a0124006e3f6d42f10495866a6ca772fcf413 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Jos=C3=A9=20Guti=C3=A9rrez=20de=20Quevedo=20P=C3=A9?= =?UTF-8?q?rez?= Date: Tue, 15 Dec 2020 11:41:46 +0100 Subject: [PATCH] add a C version of the 2 problem I wanted to check how much faster a C version would be. As it turns out it is *MUCH* faster, the python version takes ca. 12s, the C version takes a few milliseconds. --- 15/2.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 15/2.c diff --git a/15/2.c b/15/2.c new file mode 100644 index 0000000..f0696d6 --- /dev/null +++ b/15/2.c @@ -0,0 +1,31 @@ +#include +#include + +uint32_t content[] = {2,0,6,12,1,3}; +uint32_t spoken[30000000] = {0}; + +int main(int argc, char *argv[]) +{ + + uint32_t new_spoken = 0; + uint32_t turn = 1; + uint32_t last_turn = 0; + + for(int i = 0; i