diff options
author | Tom Smeding <tom@tomsmeding.com> | 2021-12-09 21:19:32 +0100 |
---|---|---|
committer | Tom Smeding <tom@tomsmeding.com> | 2021-12-09 21:19:32 +0100 |
commit | 8d5debe81041eb0aea1f63c60189aa81a40cebde (patch) | |
tree | d06634af295c79539efc71b873483072ed74f601 /2021/9pre.cpp | |
parent | 1d02c3d4dd9da29532dcc69af21fc58d21030fc8 (diff) |
9
Diffstat (limited to '2021/9pre.cpp')
-rw-r--r-- | 2021/9pre.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/2021/9pre.cpp b/2021/9pre.cpp new file mode 100644 index 0000000..2ef4707 --- /dev/null +++ b/2021/9pre.cpp @@ -0,0 +1,26 @@ +#include <iostream> +#include <vector> +#include <string> +#include <cstdint> + + +int main() { + std::vector<std::string> lines; + std::string line; + while (std::getline(std::cin, line)) { + for (char &c : line) c -= '0'; + lines.emplace_back(std::move(line)); + } + + const uint64_t height = lines.size(); + const uint64_t width = lines[0].size(); + std::cout.put('b'); + std::cout.put(2); + std::cout.put(2); + std::cout.write(" u8", 4); + std::cout.write((const char*)&height, 8); + std::cout.write((const char*)&width, 8); + for (uint64_t y = 0; y < height; y++) { + std::cout.write(lines[y].data(), width); + } +} |