답안 #397477

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
397477 2021-05-02T09:39:33 Z Iwanttobreakfree Marko (COCI15_marko) C++17
50 / 50
32 ms 1028 KB
#include <iostream>
#include <string>
#include <map>
using namespace std;
int main(){
	int n;
	string str,id;
	cin>>n;
	map<char,char> tradu;
	map<string,int> words;
	char c='a';
	for(int i=0;i<26;i++){
		if(i<3)tradu.insert(make_pair(c,'2'));
		else if(i<6)tradu.insert(make_pair(c,'3'));
		else if(i<9)tradu.insert(make_pair(c,'4'));
		else if(i<12)tradu.insert(make_pair(c,'5'));
		else if(i<15)tradu.insert(make_pair(c,'6'));
		else if(i<19)tradu.insert(make_pair(c,'7'));
		else if(i<22)tradu.insert(make_pair(c,'8'));
		else tradu.insert(make_pair(c,'9'));
		c++;
	}
	while(n--){
		id="";
		cin>>str;
		int m=str.length();
		for(int i=0;i<m;i++){
			id+=tradu[str[i]];
		}
		if(words.find(id)==words.end())words.insert(make_pair(id,1));
		else words[id]++;
	}
	cin>>str;
	if(words.find(str)==words.end())cout<<0;
	else cout<<words[str];
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 30 ms 932 KB Output is correct
5 Correct 5 ms 332 KB Output is correct
6 Correct 5 ms 308 KB Output is correct
7 Correct 18 ms 828 KB Output is correct
8 Correct 32 ms 1028 KB Output is correct
9 Correct 5 ms 332 KB Output is correct
10 Correct 25 ms 716 KB Output is correct