Submission #171866

#TimeUsernameProblemLanguageResultExecution timeMemory
171866ToniBMarko (COCI15_marko)C++14
50 / 50
113 ms1656 KiB
#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 (stderr)

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