Codeforce Superhero Transformation A
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | string s = "aeiou"; int main(){ string a, b; cin >> a >> b; //길이가 다르면 절대 불가능 if(a.size() != b.size()) cout << "No"; else{ for(int i=0; i<a.size(); ++i){ int x = s.find(a[i]); int y = s.find(b[i]); if(x == std::string::npos && y==std::string::npos || x != -1 && y!= -1) continue; cout << "No"; return 0; } cout << "Yes"; } } | cs |
문제 출처:https://codeforces.com/contest/1111/problem/A
간단한 문제였는데 대회진행 때는 못풀어서 아쉬웠다 ㅠㅠ 실력이 부족한거겠지...
문장 s를 문장 t로 변환이 가능한지 체크하는 문제였다.
모음->모음 자음->자음인 것만 확인할 수 있으면 변환 가능한 문장이다.
대회 때 틀린 이유는 s.size()!=t.size()이면 무조건 No인 것을 간과했기 떄문 ㅠㅠ
'알고리즘 > Codeforce' 카테고리의 다른 글
Codeforces Round 560 Div 3 C Good String (0) | 2019.05.18 |
---|---|
Codeforces Round 560 Div. 3 B Polycarp Training (0) | 2019.05.18 |
Codeforces Round 560 Div. 3 A Remainder (0) | 2019.05.18 |
Codeforces Round 560 Div. 3 D Almost All Divisors (0) | 2019.05.18 |