Submission #95298

# Submission time Handle Problem Language Result Execution time Memory
95298 2019-01-29T19:58:03 Z karlopuh Marko (COCI15_marko) C++14
50 / 50
24 ms 888 KB
#include <bits/stdc++.h>
using namespace std;

vector <string > iz;
int brojac;


int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		string r;
		cin>>r;
		string f;
		for(int j=0;j<r.length();j++){
			if(r[j]>='a' && r[j]<='c'){
				f+="2";
			}
			else if(r[j]>='d' && r[j]<='f'){
				f+="3";
			}
			else if(r[j]>='g' && r[j]<='i'){
				f+="4";
			}
			else if(r[j]>='j' && r[j]<='l'){
				f+="5";
			}
			else if(r[j]>='m' && r[j]<='o'){
				f+="6";
			}
			else if(r[j]>='p' && r[j]<='s'){
				f+="7";
			}
			else if(r[j]>='t' && r[j]<='v'){
				f+="8";
			}
			else if(r[j]>='w' && r[j]<='z'){
				f+="9";
			}
		}
		iz.push_back(f);
	}
	
	string unos;
	cin>>unos;
	for(int i = 0; i < n; i++){
		if(iz[i]==unos)brojac++;
	}
	
	cout<<brojac;
}

Compilation message

marko.cpp: In function 'int main()':
marko.cpp:15:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j=0;j<r.length();j++){
               ~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 22 ms 888 KB Output is correct
5 Correct 4 ms 376 KB Output is correct
6 Correct 4 ms 376 KB Output is correct
7 Correct 14 ms 632 KB Output is correct
8 Correct 24 ms 888 KB Output is correct
9 Correct 4 ms 376 KB Output is correct
10 Correct 17 ms 632 KB Output is correct