답안 #223136

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
223136 2020-04-14T23:21:29 Z Haunted_Cpp Slon (COCI15_slon) Python 3
120 / 120
341 ms 25716 KB
n = str (input())
p, m = map (int, input().split())

a = eval(n.replace("x", str(1))) 
b = eval(n.replace("x", str(2)))

start = eval(n.replace("x", str(0))) 
diff = b - a

for i in range (1000000):
  if (start == p) :
    print(i)
    break
  start = start + diff
  start %= m
  
# 결과 실행 시간 메모리 Grader output
1 Correct 341 ms 3364 KB Output is correct
2 Correct 257 ms 25716 KB Output is correct
3 Correct 38 ms 3440 KB Output is correct
4 Correct 104 ms 3420 KB Output is correct
5 Correct 37 ms 3432 KB Output is correct
6 Correct 245 ms 4420 KB Output is correct
7 Correct 66 ms 5324 KB Output is correct
8 Correct 88 ms 9544 KB Output is correct
9 Correct 115 ms 11508 KB Output is correct
10 Correct 160 ms 18368 KB Output is correct