최대 1 분 소요

1. 문제Permalink

[Bronze III] 5의 수난 - 23037Permalink

문제 링크

성능 요약Permalink

메모리: 30840 KB, 시간: 72 ms

분류Permalink

사칙연산(arithmetic), 수학(math)

출처: 백준, https://https://www.acmicpc.net/

2. 해결방법 시간복잡도Permalink

  1. 단순 코딩 O(N)

3. 문제 해결 및 코드Permalink


import sys
input = sys.stdin.readline
N = str(int(input()))
cnt = 0
for i in N:
cnt += int(i) ** 5
print(cnt)
view raw 23037.py hosted with ❤ by GitHub
  • 주석을 참고하면서 이해를 돕습니다.Permalink

4. 알고리즘 및 해설Permalink

  1. 입력값을 정수형으로 받은 뒤 다시 문자열로 받는다.
  2. 해당 문자열의 각각의 문자의 수의 5제곱을 변수에 더해준뒤 변수를 출력한다.