Algorithm Problems
[백준/Python] 14717번 앉았다 - BruteForce
WakaraNai
2021. 7. 20. 03:50
728x90
반응형
https://www.acmicpc.net/problem/14717
14717번: 앉았다
영학이의 패를 뜻하는 두 개의 정수 A, B가 주어진다. (1 ≤ A, B ≤ 10)
www.acmicpc.net
Python
import sys
input = sys.stdin.readline
a, b = map(int, input().split())
total = 9*17
ans = 0
if a == b:
ans = total - (10-a)
else:
mypoint = (a+b) % 10
for i in range(1, 11):
for j in range(i+1, 11):
if mypoint > (i+j) % 10:
if i == a and j == b:
continue
elif i == a or j == a or i == b or j == b:
ans += 2
else:
ans += 4
print("%.3f" % (ans / total))
728x90
반응형