Programming/CodingTest

[코드트리] 삼성 SW 역량테스트 | 2015 하반기 1번 | 바이러스 검사

콩순이컴퓨터 2025. 6. 1. 23:50

https://www.codetree.ai/ko/frequent-problems/samsung-sw/problems/virus-detector/description

 

코딩테스트 기출 문제 설명: 바이러스 검사 | 코드트리

코딩테스트 기출 문제 바이러스 검사의 상세 설명입니다. 문제 요구사항을 정확히 파악하고 효율적인 알고리즘을 설계해보세요.

www.codetree.ai

 

  • 문제유형 : Basic
  • 난이도 : L4
  • 정답률 : 35%

 

풀이 방법 

 

 

코드

# 1. 입력받기
n = int(input())
people = list(map(int, input().split()))
a, b = map(int, input().split())

# 2. 검사자 수 구하기
result = 0
for p in people:
    rest = p - a
    result += 1

    if rest > 0:
        if rest % b == 0:
            result += (rest//b)
        else:
            result += (rest//b + 1)

print(result)