Submission #104669

#TimeUsernameProblemLanguageResultExecution timeMemory
104669MatesV13Marko (COCI15_marko)C++11
50 / 50
16 ms1484 KiB
#include <bits/stdc++.h> using namespace std; int n; string w[1005], s; bool ok[1005]; int tonum(char x){ if (x=='a') return 2; if (x=='b') return 2; if (x=='c') return 2; if (x=='d') return 3; if (x=='e') return 3; if (x=='f') return 3; if (x=='g') return 4; if (x=='h') return 4; if (x=='i') return 4; if (x=='j') return 5; if (x=='k') return 5; if (x=='l') return 5; if (x=='m') return 6; if (x=='n') return 6; if (x=='o') return 6; if (x=='p') return 7; if (x=='q') return 7; if (x=='r') return 7; if (x=='s') return 7; if (x=='t') return 8; if (x=='u') return 8; if (x=='v') return 8; if (x=='w') return 9; if (x=='x') return 9; if (x=='y') return 9; if (x=='z') return 9; } int main (){ ios::sync_with_stdio(0); cin.tie(0); cin >> n; for (int i=0;i<n;i++){ cin >> w[i]; ok[i]++; } cin >> s; for (int i=0;i<s.size();i++){ for (int j=0;j<n;j++){ if (tonum(w[j][i]) != (int)s[i] - (int)'0') ok[j]=0; } } int ans=0; for (int i=0;i<n;i++) ans+=ok[i]; cout << ans; return 0; }

Compilation message (stderr)

marko.cpp: In function 'int main()':
marko.cpp:40:7: warning: use of an operand of type 'bool' in 'operator++' is deprecated [-Wdeprecated]
  ok[i]++;
       ^~
marko.cpp:43:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 for (int i=0;i<s.size();i++){
              ~^~~~~~~~~
marko.cpp: In function 'int tonum(char)':
marko.cpp:33:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#Verdict Execution timeMemoryGrader output
Fetching results...