From 2d02f553aa4cc4ded630628eccdf34f55937cee5 Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Wed, 14 Dec 2016 20:19:02 +0100 Subject: Add 2015 sources --- 2015/day20.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 2015/day20.cpp (limited to '2015/day20.cpp') diff --git a/2015/day20.cpp b/2015/day20.cpp new file mode 100644 index 0000000..2da1fa2 --- /dev/null +++ b/2015/day20.cpp @@ -0,0 +1,23 @@ +#include +#include + +using namespace std; + +int main(void){ + const int limit=10000000; //1e7 + cerr<<"Alloc..."; + int *scores=(int*)calloc(limit+1,sizeof(int)); + cerr<<" done."<50)ilimit=50; + for(i=1;i<=ilimit;i++){ + scores[elf*i]+=elf*11; + } + if(scores[elf]>=36000000)break; + } + for(i=1;i<20;i++)cout<