[백준/파이썬] 10395번 풀이
업데이트:
문제 정보
- 문제 출처: 백준 온라인 저지
- 문제 링크: 10395번 문제
- 문제풀이 코드 GitHub 링크
- 제출 언어: Python 3
풀이
문제
The Internet Computer Parts Company (ICPC) is an on-line shop that sells computer parts. Pairs of in-line electrical connectors are among the most popular parts that ICPC sells. However, they are also one of the parts that are returned more often by unsatisfied customers, because due to errors in packaging the connectors sent to the costumers may not be compatible.
An in-line connector is composed of five connection points, labelled from 1 to 5. Each connection point of a connector can be either a plug or an outlet. …
입력 요약
The first line contains five integers Xi (0 ≤ Xi ≤ 1 for i = 1, 2, . . . , 5), representing the connection points of the first connector in the pair. The second line contains five integers Yi (0 ≤ Yi ≤ 1 for i = 1, 2, . . . …
출력 요약
Output a line with a character representing whether the connectors are compatible or not. If they are compatible write the uppercase letter “Y”; otherwise write the uppercase letter “N”.
코드
a=list(map(int,input().split()))
b=list(map(int,input().split()))
f=True
for i in range(5):
if a[i]==b[i]:f=False;break
print('Y'if f else'N')
설명
핵심은 구현 관점에서 The Internet Computer Parts Company (ICPC) is an on-line shop that sells computer parts. …를 만족하도록 로직을 구성하는 것입니다.
코드는 입력을 파싱한 뒤 조건 분기와 계산을 순서대로 수행하고, 문제에서 요구한 형식으로 결과를 출력합니다.
경계값과 예외 케이스도 함께 고려해 오답이 나기 쉬운 상황을 방지합니다.
댓글남기기