답안 #383148

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
383148 2021-03-28T22:41:07 Z Iwanttobreakfree Kartomat (COCI17_kartomat) C++
72 / 80
1 ms 364 KB
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main(){
	int n;
	string st;
	vector<bool> l(26,false);
	cin>>n;
	vector<string> str(n);
	for(int i=0;i<n;i++)cin>>str[i];
	cin>>st;
	int k=st.length();
	for(int i=0;i<n;i++){
		bool pos=true;
		for(int j=0;j<k;j++){
			if(str[i][j]!=st[j]){
				pos=false;
				break;
			}
			if(str[i].length()>k&&pos)l[str[i][k]-'A']=true;
		}
	}
	cout<<"***";
	for(int i=0;i<5;i++){
		char c=i+'A';
		if(l[i])cout<<c;
		else cout<<'*';
	}
	cout<<'\n';
	for(int i=5;i<13;i++){
		char c=i+'A';
		if(l[i])cout<<c;
		else cout<<'*';
	}
	cout<<'\n';
	for(int i=13;i<21;i++){
		char c=i+'A';
		if(l[i])cout<<c;
		else cout<<'*';
	}
	cout<<'\n';
	for(int i=21;i<26;i++){
		char c=i+'A';
		if(l[i])cout<<c;
		else cout<<'*';
	}
	cout<<"***";
	cout<<'\n';
}

Compilation message

kartomat.cpp: In function 'int main()':
kartomat.cpp:21:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   21 |    if(str[i].length()>k&&pos)l[str[i][k]-'A']=true;
      |       ~~~~~~~~~~~~~~~^~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Incorrect 1 ms 364 KB Output isn't correct
10 Correct 1 ms 364 KB Output is correct