답안 #167379

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
167379 2019-12-07T19:39:59 Z 44442 Marko (COCI15_marko) C++11
50 / 50
9 ms 1272 KB
#include <bits/stdc++.h>
using namespace std;
long long n,b,a,ok,okk,minn,e,h,ee,c;
string s[1004],d;
int main (){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin>>n;
for(int i=0;i<n;i++){
	 cin>>s[i];
}
cin>>d;
e=d.size()-1;
for(int i=0;i<n;i++){
	 ok=1;
	 h=0;
	 minn=2;
	 ee=e;
 for(int j=s[i].size()-1;h<minn;j--){
 	     long long f=s[i].size();
 	     minn=min(f,e+1);
	 	 c=(int)s[i][j]-96;
	 	 if(c<=3){
	 	 	 b=2;
		 }
		 else if(c<=6){
		 	 b=3;
		 }
		 else if(c<=9){
		 	 b=4;
		 }
		 else if(c<=12){
		 	 b=5;
		 }
		 else if(c<=15){
		 	 b=6;
		 }
		 else if(c<=19){
		 	 b=7;
		 }
		 else if(c<=22){
		 	 b=8;
		 }
		 else{
		 	 b=9;
		 }
	 if(((int)d[ee]-48)!=b){
	 	 ok=0;
	 }	 
	 h++;
	 ee--;	 
	 }
	 if(ok){
	 	 okk++;
	 }
}
cout<<okk;
return 0;
}


# 결과 실행 시간 메모리 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 8 ms 1272 KB Output is correct
5 Correct 3 ms 508 KB Output is correct
6 Correct 3 ms 508 KB Output is correct
7 Correct 4 ms 1020 KB Output is correct
8 Correct 9 ms 1272 KB Output is correct
9 Correct 3 ms 504 KB Output is correct
10 Correct 7 ms 1144 KB Output is correct