[洛谷P4346][CERC2015]ASCII Addition

题目大意:给一个像素的$a+b$,每个数字为$7 imes5$的像素,每两个数字之间有间隔

题解:乱搞读入

卡点:

C++ Code:

#include <cstdio>
#include <cstring>
#include <iostream>
using std::cin;
using std::endl;
using std::cout;
using std::string;
const string S[11] = {
	"xxxxx.x...x.x...x.x...x.x...x.x...x.xxxxx.",
	"....x.....x.....x.....x.....x.....x.....x.",
	"xxxxx.....x.....x.xxxxx.x.....x.....xxxxx.",
	"xxxxx.....x.....x.xxxxx.....x.....x.xxxxx.",
	"x...x.x...x.x...x.xxxxx.....x.....x.....x.",
	"xxxxx.x.....x.....xxxxx.....x.....x.xxxxx.",
	"xxxxx.x.....x.....xxxxx.x...x.x...x.xxxxx.",
	"xxxxx.....x.....x.....x.....x.....x.....x.",
	"xxxxx.x...x.x...x.xxxxx.x...x.x...x.xxxxx.",
	"xxxxx.x...x.x...x.xxxxx.....x.....x.xxxxx.",
	"........x.....x...xxxxx...x.....x.........",
};
string p[7];
int x, idx = 0;
char ch;
inline char getch() {
	string tmp = "";
	for (int i = 0; i < 7; i++) tmp += p[i].substr(idx, 6);
	idx += 6;
	for (int i = 0; i < 10; i++) if (S[i] == tmp) return i + 48;
	return 0;
}
inline int read() {
	x = 0; ch = getch();
	while (!ch) ch = getch();
	for (x = ch & 15, ch = getch(); ch; ch = getch()) x = x * 10 + (ch & 15);
	return x;
}
string out[7];
void putch(int x, int op) {
	for (int i = 0; i < 7; i ++) out[i] += S[x].substr(i * 6, 5 + op);
}
void put(int x, int op = 1) {
	if (x > 9) put(x / 10);
	putch(x % 10, op);
}
int main() {
	for (int i = 0; i < 7; i++) cin >> p[i], p[i] = p[i] + ".";
	int ans = read() + read();
	put(ans, 0);
	for (int i = 0; i < 7; i++) cout << out[i] << " " << endl;
	return 0;
}

  

原文地址:https://www.cnblogs.com/Memory-of-winter/p/9713554.html