※ 글쓴이는 취미로 코딩을 익혀보는 사람이라 정확하지 않은 내용을 담고 있을 수 있다 ※
이번에 볼 문제는 백준 25277번 문제인 Culture shock이다.
문제는 아래 링크를 확인하자.
https://www.acmicpc.net/problem/25277
25277번: Culture shock
Thore is a visiting scholar at a progressive university, whose administrators have decided that gendered pronouns are politically incorrect. The pronouns he, she, him, and her must be replaced with the gender neutral they and them. Thore doesn't want to ap
www.acmicpc.net
주어지는 문장을 구성하는 단어마다 각 단어가 he, him, she, her중 하나인지를 확인하는 것으로 문제를 해결하자.
아래는 제출한 소스코드이다.
#include <iostream>
#include <string>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int ans = 0;
int N; cin >> N;
while (N--) {
string s; cin >> s;
if (s == "he" || s == "she" || s == "him" || s == "her") ans++;
}
cout << ans;
}
728x90
'BOJ' 카테고리의 다른 글
[BOJ 3085 // C++] 사탕 게임 (0) | 2022.11.12 |
---|---|
[BOJ 24623 // C++] Изгороди (0) | 2022.11.12 |
[BOJ 24296 // C++] ЛИНИЯ (0) | 2022.11.11 |
[BOJ 25278 // C++] Terraforming (0) | 2022.11.11 |
[BOJ 25527 // C++] Counting Peaks of Infection (0) | 2022.11.11 |