문제 링크입니다: www.acmicpc.net/problem/16017
16017번: Telemarketer or not?
Here at the Concerned Citizens of Commerce (CCC), we have noted that telemarketers like to use seven-digit phone numbers where the last four digits have three properties. Looking just at the last four digits, these properties are: the first of these four d
www.acmicpc.net
간단한 구현 문제였습니다.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
const int MAX = 4; | |
int main(void) | |
{ | |
ios_base::sync_with_stdio(0); | |
cin.tie(0); | |
bool isTelemarketNum = true; | |
int number[MAX]; | |
for (int i = 0; i < MAX; i++) | |
{ | |
cin >> number[i]; | |
if ((i == 0 || i == 3) && !(8 <= number[i] && 9 >= number[i])) | |
{ | |
isTelemarketNum = false; | |
} | |
if (i == 2 && number[i] != number[i-1]) | |
{ | |
isTelemarketNum = false; | |
} | |
} | |
cout << (isTelemarketNum ? "ignore\n" : "answer\n"); | |
return 0; | |
} |


개발환경:Visual Studio 2017
지적, 조언, 질문 환영입니다! 댓글 남겨주세요~
반응형
'알고리즘 > BOJ' 카테고리의 다른 글
백준 16431번 베시와 데이지 (0) | 2021.03.24 |
---|---|
백준 16199번 나이 계산하기 (0) | 2021.03.23 |
백준 15963번 CASIO (0) | 2021.03.23 |
백준 15921번 수찬은 마린보이야!! (0) | 2021.03.22 |
백준 15873번 공백 없는 A+B (0) | 2021.03.22 |