Submission #1013953

#TimeUsernameProblemLanguageResultExecution timeMemory
1013953May27_thMarko (COCI15_marko)C++17
50 / 50
7 ms1052 KiB
#include<bits/stdc++.h> using namespace std; #define i64 long long #define i128 __int128 #define mp make_pair #define pb push_back #define all(x) (x).begin(), (x).end() void Solve(void) { map<char, int> mp; for (int i = 0; i < 15; i ++) { mp[char(i + 'a')] = i/3 + 2; } for (int i = 15; i <= 18; i ++) { mp[char(i + 'a')] = 7; } for (int i = 19; i <= 21; i ++) { mp[char(i + 'a')] = 8; } for (int i = 22; i <= 25; i ++) { mp[char(i + 'a')] = 9; } int N; cin >> N; vector<string> S(N); for (int i = 0; i < N; i ++) { cin >> S[i]; } string pressed; cin >> pressed; int ans = 0; for (int i = 0; i < N; i ++) { if ((int)pressed.size() != (int)S[i].size()) continue; bool flag = true; for (int j = 0; j < (int)S[i].size(); j ++) { // cout << mp[S[i][j]] << " " << pressed[j] - '0' << "\n"; if (mp[S[i][j]] != pressed[j] - '0') { flag = false; } } ans += flag; } cout << ans << "\n"; } signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(10); int Tests = 1; // cin >> Tests; while (Tests --) { Solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...