#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(){
int br[26] = {2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9};
char slova[26];
for(int i = 0; i < 26; ++i){
slova[i] = i + 97;
}
int n;
cin >> n;
string r[n];
int sl[n] = {0};
for(int i = 0; i < n; ++i){
cin >> r[i];
}
string s;
cin >> s;
for(int i = 0; i < s.length(); ++i){
for(int j = 0; j < n; ++j){
string rijec = r[j];
if(rijec.length() == s.length()){
int ind = 0;
int ind2 = s[i] - 48;
for(int k = 0; k < 26; ++k){
if(rijec[i] == slova[k]){
ind = br[k];
if(ind == ind2) sl[j]++;
}
}
}
}
}
int sol = 0;
for(int i = 0; i < n; ++i){
if(sl[i] == s.length()) sol++;
}
cout << sol;
return 0;
}
Compilation message
marko.cpp: In function 'int main()':
marko.cpp:28:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 0; i < s.length(); ++i){
~~^~~~~~~~~~~~
marko.cpp:49:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if(sl[i] == s.length()) sol++;
~~~~~~^~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
504 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
107 ms |
1572 KB |
Output is correct |
5 |
Correct |
12 ms |
504 KB |
Output is correct |
6 |
Correct |
16 ms |
504 KB |
Output is correct |
7 |
Correct |
31 ms |
1016 KB |
Output is correct |
8 |
Correct |
113 ms |
1656 KB |
Output is correct |
9 |
Correct |
15 ms |
476 KB |
Output is correct |
10 |
Correct |
88 ms |
1184 KB |
Output is correct |