Part 2 done!

master
sigonasr2 12 months ago
parent 661a6268b8
commit 3c207d50eb
  1. 14
      Day 5/main.cpp

@ -24,7 +24,7 @@ void wait(int pauseMs=0){
#pragma endregion
const int DAY = 5;
Run runInput=FILE1;
Run runInput=FILE2;
struct Seed{
long long val;
@ -101,18 +101,20 @@ void doStuff(){
}
for(Seed&seed:seeds){
for(long long seedNumb=seed.val;seedNumb<seed.val+seed.range;seedNumb++){
std::cout<<"Initial Number: "<<seedNumb<<' ';
for(long long originalNumb=seed.val;originalNumb<seed.val+seed.range;originalNumb++){
long long seedNumb=originalNumb;
//std::cout<<"Initial Number: "<<seedNumb<<' ';
for(std::vector<Transform>&transformList:transforms){
for(Transform&transform:transformList){
if(seedNumb>=transform.source&&seedNumb<transform.source+transform.range){
seedNumb+=transform.dest-transform.source;
continue;
break;
}
}
//std::cout<<seedNumb<<" ";
}
std::cout<<"Number Out: "<<seedNumb<<std::endl;
if(seedNumb<smallest)seedNumb=smallest;
//std::cout<<"Number Out: "<<seedNumb<<std::endl;
if(seedNumb<smallest)smallest=seedNumb;
}
}
std::cout<<smallest<<std::endl;

Loading…
Cancel
Save