답안 #165615

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
165615 2019-11-27T19:11:10 Z beso123 Marko (COCI15_marko) C++14
50 / 50
57 ms 3576 KB
#include <bits/stdc++.h>
#define ll long long
using namespace std;
map <char,int>mp;
int main(){
mp['a']=2; mp['b']=2;mp['c']=2;
mp['d']=3; mp['e']=3;mp['f']=3;
mp['g']=4; mp['h']=4;mp['i']=4;
mp['j']=5; mp['k']=5;mp['l']=5;
mp['m']=6; mp['n']=6;mp['o']=6;
mp['p']=7; mp['q']=7;mp['r']=7;mp['s']=7;
mp['t']=8; mp['u']=8;mp['v']=8;
mp['w']=9; mp['x']=9;mp['y']=9;mp['z']=9;
int n;
cin>>n;
vector<int> v[1001];
for(int k=1;k<=n;k++){
    string s;
    cin>>s;
    for(int i=0;i<s.size();i++){
        v[k].push_back(mp[s[i]]);
    }
}
string no;
cin>>no;
int ans=0;
    for(int k=1;k<=n;k++){
        if(v[k].size()<no.size())
        continue;
        int ind=0;
for(int i=0;i<no.size();i++){
        int y=no[i]-'0';
if(v[k][i]!=y){
    ind=1;
    break;
}
    }
    if(ind==0)
        ans++;
    }
    cout<<ans;
return 0;
}

Compilation message

marko.cpp: In function 'int main()':
marko.cpp:20:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<s.size();i++){
                 ~^~~~~~~~~
marko.cpp:31:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 for(int i=0;i<no.size();i++){
             ~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 56 ms 3576 KB Output is correct
5 Correct 9 ms 760 KB Output is correct
6 Correct 9 ms 760 KB Output is correct
7 Correct 31 ms 1912 KB Output is correct
8 Correct 57 ms 3448 KB Output is correct
9 Correct 9 ms 888 KB Output is correct
10 Correct 39 ms 2168 KB Output is correct