diff --git a/2023/11/main-1.cpp b/2023/11/main-1.cpp index 17bdcf3..81e5935 100644 --- a/2023/11/main-1.cpp +++ b/2023/11/main-1.cpp @@ -1,14 +1,18 @@ #include using namespace std; -int main() { +int main(int argc, char* argv[]) { ios::sync_with_stdio(0); cin.tie(0); + bool dontwork = argc == 2 && !strcmp(argv[1], "DONTWORK"); + vector lines; string line; while (getline(cin, line) && !line.empty()) { lines.push_back(line); + if (dontwork) + goto next1; for (char c : line) { if (c != '.') { goto next1; @@ -18,6 +22,8 @@ int main() { next1:; } + if (dontwork) + goto next3; for (unsigned int col = 0; col < lines[0].size(); col++) { for (auto& r : lines) { if (r[col] != '.') { @@ -30,6 +36,7 @@ int main() { col++; next2:; } +next3: vector> gs; for (unsigned int row = 0; row < lines.size(); row++) { diff --git a/2023/11/main-2.rb b/2023/11/main-2.rb new file mode 100755 index 0000000..f797960 --- /dev/null +++ b/2023/11/main-2.rb @@ -0,0 +1,13 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# decidedly mozzarella flavored + +`make main-1` + +file_name = 'data.txt' + +base = Integer(`./main-1 DONTWORK < #{file_name}`) +plus1 = Integer(`./main-1 < #{file_name}`) + +puts base + (plus1 - base) * 999_999