자라는 개발자/문제풀이
백준 c++ 9933 민균이의 비밀번호
자란다
2022. 8. 8. 18:28
728x90
반응형
9933 민균이의 비밀번호
문제풀이
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
void fast_io(void)
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
int t;
vector<string> v;
vector<string> rv;
int main()
{
fast_io();
cin >> t;
for(int i=0;i<t;i++)
{
string tmp;
cin >> tmp;
v.push_back(tmp);
reverse(tmp.begin(),tmp.end());
rv.push_back(tmp);
}
for(int i=0;i<t;i++)
{
for(int j=0;j<t;j++)
if(!v[i].compare(rv[j]))
{
int len = v[i].length();
cout << len << " " << v[i][len/2];
return 0;
}
}
}
받은 값을 반전시켜준뒤 각각 넣어놓고 값을 비교해주었다.
728x90
반응형