blob: 2ef4707db1d4a08dac9d2632f2d9125808918bc7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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);
}
}
|