답안 #19185

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
19185 2016-02-19T23:14:11 Z hongjun7 Zu (kriii2_Z) C++
컴파일 오류
0 ms 0 KB
#include <stdio.h>
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
int n, m;
vector <string> a;
vector<string> F(int i, int j) {
	vector<string> s;
	for (int k = i; k <= i + 4; k++) s.push_back(a[k].substr(j, 5));
	return s;
}
map<string, string> d;
int main() {
	d["#####""..#..""#...#""#####""#####"] = "a";
	d["#####""#...#""#.#.#""....#""#####"] = "b";
	d["#####""###..""###.#""###..""#####"] = "c";
	d["#####""#####""#####""..###""#.###"] = "d";
	d["#####""..###""#.###""#....""#####"] = "e";
	d["#####""#.#.#""....#""#.#.#""#####"] = "f";
	d["###.#""##..#""##.##""##..#""###.#"] = "g";
	d["#####""#...#""#.#.#""#...#""###.#"] = "h";
	d["#.#.#""#...#""#####""#####""#####"] = "i";
	d["#####""#####""#####""###..""###.#"] = "j";
	d["###.#""###.#""###.#""#...#""#.###"] = "kq";
	d["#####""#...#""##.##""#...#""##.##"] = "l";
	d["#####""#####""#...#""..#..""#####"] = "m";
	d["#####""#....""#.#.#""#...#""#####"] = "n";
	d["#####""..###""#.###""..###""#####"] = "o";
	d["###.#""###..""#####""#####""#####"] = "p";
	d["#####""....#""###.#""###..""#####"] = "z";
	d["#####""#.#.#""#....""#.#.#""#####"] = "r";
	d["#.###""#..##""##.##""#..##""#.###"] = "s";
	d["#.###""#...#""#.#.#""#...#""#####"] = "t";
	d["#####""#####""#####""#...#""#.#.#"] = "uv";
	d["#.###""..###""#####""#####""#####"] = "w";
	d["###.#""#...#""#.###""#.###""#.###"] = "x";
	d["##.##""#...#""##.##""#...#""#####"] = "y";
	d["#####""#...#""#...#""#...#""#####"] = "0";
	d["#####""#.#.#""#.#.#""#...#""#####"] = "1";
	d["#####""#...#""#.###""#...#""#####"] = "2";
	d["#####""#...#""#.#.#""#.#.#""#####"] = "3";
	d["#####""#.#.#""#.###""#...#""#####"] = "3";
	d["#####""#...#""###.#""#...#""#####"] = "4";
	d["#####""#.#.#""#.#.#""#.#.#""#####"] = "4";
	d["#####""#...#""#.###""#.#.#""#####"] = "5";
	d["#####""#.#.#""###.#""#...#""#####"] = "5";
	d["#####""#...#""#####""#...#""#####"] = "6";
	d["#####""#.#.#""#.###""#.#.#""#####"] = "6";
	d["#####""#...#""###.#""#.#.#""#####"] = "7";
	d["#####""#.#.#""#####""#...#""#####"] = "7";
	d["#####""#.#.#""###.#""#.#.#""#####"] = "8";
	d["#####""#...#""#####""#.#.#""#####"] = "9";
	d["#####""#.#.#""#####""#.#.#""#####"] = "10";
	d["....."".....""....."".....""....."] = "_";
	scanf("%d%d", &n, &m);
	a.resize(6 * n - 1);
	for (int i = 0; i < 6 * n - 1; i++) cin >> a[i];
	for (int j = m - 1; j >= 0; j--) {
		for (int i = 0; i < n; i++) {
			string s = "";
			vector<string> e = F(i * 6, j * 6);
			for (auto &j : e) s += j;
			printf("%s", d[s].c_str());
		}
		puts("");
	}
}

Compilation message

Z.cpp: In function ‘int main()’:
Z.cpp:66:9: warning: ‘auto’ changes meaning in C++11; please remove it [-Wc++0x-compat]
    for (auto &j : e) s += j;
         ^
Z.cpp:66:15: error: ISO C++ forbids declaration of ‘j’ with no type [-fpermissive]
    for (auto &j : e) s += j;
               ^
Z.cpp:66:19: error: range-based ‘for’ loops are not allowed in C++98 mode
    for (auto &j : e) s += j;
                   ^
Z.cpp:59:23: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &n, &m);
                       ^