답안 #87381

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
87381 2018-11-30T15:52:49 Z jvalsortav 고장난 휴대전화기 (COCI14_mobitel) C++14
컴파일 오류
0 ms 0 KB
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <cctype>
#include <ctime>
#include <set>
#include <string.h>
#include <map>
#include <vector>

using namespace std;

char s[110], w[200];
int x, l[20], p, a, b;
vector <int> v[11];
bool z = false;

int main() {
	
	int y = 'a';
	for (int i = 2; i < 10; i++){
		
		if(i == 7 or i == 9){
			for (int j = 0; j < 4; j++){
				v[i].push_back(y);
				y++;
			}
			continue;
		}
		
		for (int j = 0; j < 3; j++){
			v[i].push_back(y);
			y++;
		}
	}
	
	/*for (int i = 2; i < 10; i++){
		cout << i << " ";
		for (int j = 0; j < v[i].size(); j++){
			cout << v[i][j] << " ";
		}
		cout << endl;
	}*/
	
	
	for (int i = 1; i < 10; i++){
		cin >> l[i];
	}
	
	cin >> s;
	
	y = 'a';
	x = s[0];
	z = false;
	
	/*cout << "x = "<< x << " ";*/

	for (int i = 2; i < 10; i++){
		/*cout << s << 1 << endl;*/
		if(i == 7 or i == 9){
			for (int j = 0; j < 4; j++){
				if (v[i][j] == x){
					z = true;
					a = i; b = j;
					/*cout << "a, b = " << a << " " << b << endl;*/
					break;
				}
			}
			continue;
		}
		
		for (int j = 0; j < 3; j++){
			if (v[i][j] == x){
				z = true;
				a = i; b = j;
				/*cout << "a, b = " << a << " " << b << endl;*/
				break;
			}
		}
		if (z) break;
	}
	p = a;
	for (int i = 0; i < b+1; i++){
		/*cout << l[a];*/
		/*cout << a;*/
		/*cout << endl;*/
		for (int i = 1; i < 10; i++){
			if (l[i] == a){
				cout << i; break;
			}
		}
	}
	
	for (int i = 1; i < strlen(s); i++){
		x = s[i];
		z = false;
		/*cout << "x = " << x << " ";*/
		for (int i = 2; i < 10; i++){
			/*cout << s << 2 << endl;*/
			if(i == 7 or i == 9){
				for (int j = 0; j < 4; j++){
					if (v[i][j] == x){
						z = true;
						a = i; b = j;
						/*cout << "a, b = " << a << " " << b << endl;*/
						break;
					}
				}
				continue;
			}
		
			for (int j = 0; j < 3; j++){
				if (v[i][j] == x){
					z = true;
					a = i; b = j;
					/*cout << "a, b = " << a << " " << b << endl;*/
					break;
				}
			}
			if (z) break;
		}
		
		if (p == a) cout << "#";
		
		p = a;
		for (int i = 0; i < b+1; i++){
			/*cout << l[a];*/
			/*cout << a;*/
			/*cout << endl;*/
			for (int i = 1; i < 10; i++){
				if (l[i] == a){
					cout << i; break;
				}
			}
		}
	}

Compilation message

mobitel.cpp: In function 'int main()':
mobitel.cpp:95:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 1; i < strlen(s); i++){
                  ~~^~~~~~~~~~~
mobitel.cpp:137:2: error: expected '}' at end of input
  }
  ^