Submission #82796

#TimeUsernameProblemLanguageResultExecution timeMemory
82796xiaowuc1Marko (COCI15_marko)C++14
50 / 50
22 ms2844 KiB
#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 (stderr)

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';
                     ^
#Verdict Execution timeMemoryGrader output
Fetching results...