답안 #82796

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
82796 2018-11-01T18:35:06 Z xiaowuc1 Marko (COCI15_marko) C++14
50 / 50
22 ms 2844 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int idx[256];

int main() {
	idx['a'] = 2;
	idx['b'] = 2;
	idx['c'] = 2;

	idx['d'] = 3;
	idx['e'] = 3;
	idx['f'] = 3;

	idx['g'] = 4;
	idx['h'] = 4;
	idx['i'] = 4;

	idx['j'] = 5;
	idx['k'] = 5;
	idx['l'] = 5;

	idx['m'] = 6;
	idx['n'] = 6;
	idx['o'] = 6;

	idx['p'] = 7;
	idx['q'] = 7;
	idx['r'] = 7;
	idx['s'] = 7;

	idx['t'] = 8;
	idx['u'] = 8;
	idx['v'] = 8;

	idx['w'] = 9;
	idx['x'] = 9;
	idx['y'] = 9;
	idx['z'] = 9;

	int n;
	cin >> n;
	vector<string> v;
	while(n--) {
		string s;
		cin >> s;
		v.push_back(s);
	}
	int ret = 0;
	string want;
	cin >> want;
	for(string out: v) {
		bool good = out.size() == want.size();
		for(int i = 0; good && i < out.size(); i++) {
			good = idx[out[i]] == want[i] - '0';
		}
		if(good) ret++;
	}
	printf("%d\n", ret);

}

Compilation message

marko.cpp: In function 'int main()':
marko.cpp:57:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i = 0; good && i < out.size(); i++) {
                          ~~^~~~~~~~~~~~
marko.cpp:58:21: warning: array subscript has type 'char' [-Wchar-subscripts]
    good = idx[out[i]] == want[i] - '0';
                     ^
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
3 Correct 2 ms 504 KB Output is correct
4 Correct 21 ms 1520 KB Output is correct
5 Correct 4 ms 1520 KB Output is correct
6 Correct 5 ms 1520 KB Output is correct
7 Correct 13 ms 1880 KB Output is correct
8 Correct 22 ms 2608 KB Output is correct
9 Correct 4 ms 2608 KB Output is correct
10 Correct 17 ms 2844 KB Output is correct