BOJ - 14717 - 앉았다

Updated:

import sys

def solution():
    case = 153
    A, B = map(int, sys.stdin.readline().split())

    if A == B:
        ret = (case - (10 - A)) / case
        print("%0.3f"%ret)

    else:
        cnt = 0
        for i in range(1, 11):
            for j in range(i + 1, 11):
                sums = i + j
                if sums % 10 < (A + B) % 10:
                    if i == A or i == B or j == A or j == B: cnt += 2
                    else: cnt += 4
        ret = cnt / (case * 1.0)
        print("%0.3f"%ret)

solution()

https://www.acmicpc.net/problem/14717

Categories:

Updated:

Leave a comment