python-algorithm

백준 5940 Math Practice

무적김두칠 2022. 12. 7. 09:53

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

 

5940번: Math Practice

One lovely afternoon, Bessie's friend Heidi was helping Bessie review for her upcoming math exam. Heidi presents two integers A (0 <= A <= 45) and B (1 <= B <= 9) to Bessie who must respond with an integer E in the range 1..62. E is the smallest integer in

www.acmicpc.net

 

1
2
3
4
5
6
7
8
9
10
11
def sol(a, b):
    answer = 0
    for i in range(a+163):
        if int(str(2**i)[0]) == b:
            return i
 
    return answer
 
if __name__ == '__main__':
    a, b= map(int, input().split())
    print(sol(a, b))
cs
반응형