일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- EKS
- jmap #jstack
- Grid #CSS
- NameSpace #NS
- OCP
- Linux #wc
- DB #mariaDB #SQL
- shell #shell script
- jgrp000032 #ocp #
- Python #pakage
- EFK
- publishnotreadyaddress
- bootstrap #css #CSS
- 백준 #10430
- PODS #POD #pods #pod #파드 #재기동 #롤링재기동 #rolling
- 오블완
- Swap Memory
- istio #k8s #kubernetes
- test #비교
- dump #jattach
- Node #POD #Container
- dify
- lenova #레노버 #노트북
- lvm #lv #vg #pv
- Kafka #카프카
- 티스토리챌린지
- 네트워크 #NW
- CI #CD #CI/CD
- Excel #엑셀
- function #사용자 정의 함수
Archives
- Today
- Total
BEOM_IT
[programmers]python 181930 주사위게임 2 본문
728x90
반응형
# 주사위게임 2
# 1 - 6 까지 주사위가 세걔
# 각 a,b,c일 때 모두 다르면 a+b+c
# 두개만 같다면 (a+b+c)*(a^2+b^2+c^2)
# 모두 같다면(a+b+c)*(a^2+b^2+c^2)*(a^3+b^3+c^3)
# 제곱은 a**2 세제곱은 a**3으로 표현 가능하다는걸 깨달았다.
def solution(a, b, c):
sum=(a+b+c)
sum2=(a*a)+(b*b)+(c*c)
sum3=(a*a*a)+(b*b*b)+(c*c*c)
if a==b==c:
return int(sum*sum2*sum3)
elif (a!=b and b==c or a==c) or (a!=c and b==c or a==b) or (b !=c and b==a or c==a):
return int(sum*sum2)
elif a!=b and b!=c and a!=c:
return int(sum)
print(solution(2,6,1)) # 9
print(solution(5,3,3)) # 473
print(solution(4,4,4)) # 110592
728x90
반응형
'Algorithm > Python' 카테고리의 다른 글
[programmers]python 181832 정수 나선형으로 배치하기 (1) | 2023.12.19 |
---|---|
[programmers]python 92334 신고결과받기 (0) | 2023.12.16 |
[programmers]python 120956 옹알이(1) (0) | 2023.12.15 |
[programmers]python 181864 문자열 바꿔서 찾기 (1) | 2023.12.11 |
[programmes]python 181853 뒤에서5등까지 (0) | 2023.12.11 |