반응형
Notice
Recent Posts
Recent Comments
Link
«   2024/11   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
Archives
Today
Total
11-07 11:40
관리 메뉴

ImJay

[파이썬/Python] 백준 26209번 Intercepting Information 본문

Solved.ac - Python/Bronze V

[파이썬/Python] 백준 26209번 Intercepting Information

ImJay 2022. 12. 4. 17:04
반응형

[파이썬/Python] 백준 26209번 Intercepting Information

 

26209번: Intercepting Information

The input consists of a single line, containing $8$ integers $N_1$, $N_2$, $N_3$, $N_4$, $N_5$, $N_6$, $N_7$ and $N_8$, indicating the values read by the device ($N_i$ is 0, 1 or 9 for $1 ≤ i ≤ 8$).

www.acmicpc.net


문제

Spies Breaching Computers (SBC) is a private digital spy agency that is developing a new device for intercepting information using electromagnetic waves, which allows spying even without physical contact with the target.

The device tries to collect information one byte at a time, this is, a sequence of 8 bits where each of them, naturally, can have a value of 0 or 1. In certain situations, due to interference from other devices, the reading cannot be done successfully. In this case, the device returns the value 9 for the corresponding bit, informing that the reading could not be performed.

In order to automate the recognition of the information the device reads, a request was made for a program that, based on the information read by the device, informs whether all bits were read successfully or not. Your task is to write this program.

해설

입력 받은 정수들 중 9가 포함되어 있을 경우 "F", 포함되어 있지 않을 경우 "S" 를 출력한다.

코드

N = map(int, input().split())

print('F' if 9 in N else 'S')

풀이

1. 리스트 N을 통해 정수들을 입력 받는다.

N = map(int, input().split())

 

2. 삼항연산자를 통해 리스트 N에 9가 포함되어 있을 경우 F, 아닐 경우 S가 반환되도록 하고 이를 출력한다.

print('F' if 9 in N else 'S')

 

반응형
Comments