답안 #87980

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
87980 2018-12-03T10:31:44 Z jvalsortav Marko (COCI15_marko) C++14
50 / 50
85 ms 2788 KB
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <cctype>
#include <ctime>
#include <set>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <utility>
#include <string>
#include <map>
#include <string.h>

using namespace std;

int n, l, b;
vector <string> v;
string s, t, m;
bool inf;
int main() {
	
	cin >> n;
	
	for (int i = 0; i < n; i++){
		cin >> s;
		v.push_back(s);
	}
	
	cin >> t;
	l = t.size();
	
	for (vector <string> :: iterator it = v.begin(); it != v.end(); it++){
		inf = true;
		s = *it;
		/*cout << "hmmmmmmmmmm " << *it << endl;*/
		for (int j = 0; j < l; j++){
			if (s.substr(j, 1) >= "a" and s.substr(j, 1) <= "c"){
				m = "2";
			}
			if (s.substr(j, 1) >= "d" and s.substr(j, 1) <= "f"){
				m = "3";
			}
			if (s.substr(j, 1) >= "g" and s.substr(j, 1) <= "i"){
				m = "4";
			}
			if (s.substr(j, 1) >= "j" and s.substr(j, 1) <= "l"){
				m = "5";
			}
			if (s.substr(j, 1) >= "m" and s.substr(j, 1) <= "o"){
				m = "6";
			}
			if (s.substr(j, 1) >= "p" and s.substr(j, 1) <= "s"){
				m = "7";
			}
			if (s.substr(j, 1) >= "t" and s.substr(j, 1) <= "v"){
				m = "8";
			}
			if (s.substr(j, 1) >= "w" and s.substr(j, 1) <= "z"){
				m = "9";
			}
			
			/*cout << s.substr(j, 1) << " "<< m << endl;*/
			if (m != t.substr(j, 1)){
				inf = false;
				break;
			}
			
		}
		if (inf) b++;
	}
	cout << b;

return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 432 KB Output is correct
4 Correct 81 ms 1632 KB Output is correct
5 Correct 9 ms 1632 KB Output is correct
6 Correct 13 ms 1632 KB Output is correct
7 Correct 24 ms 1728 KB Output is correct
8 Correct 85 ms 2628 KB Output is correct
9 Correct 14 ms 2628 KB Output is correct
10 Correct 64 ms 2788 KB Output is correct