philschmid/DMath huggingface dataset:
Category: Possibility

Question (EN): There are balls with numbers from 1 to 9 written on them. Find how many ways there are when you pick 3 of them in order to make 19 by adding the numbers on the ball.
Question (KO): 1부터 9까지의 자연수가 적힌 공들이 있다. 이 중 3개를 꺼내서 공에 적힌 숫자의 합이 19가 되게 하는 방법은 모두 몇 가지인지 구하라.

Answer: 30

Solution (Python):
var_a = 1
var_b = 9
var_c = 1
list_a = [i for i in range(var_a, var_b + 1, var_c)]
var_d = 3
list_b = [str(i) for i in list_a]
list_b = list(itertools.permutations(list_b, var_d))
list_b = [''.join(num_list) for num_list in list_b]
list_b = [str_num for str_num in list_b if str_num[0] != '0']
list_b = [float(i) for i in list_b]
list_c=[]
for i in list_b:
    var_e = 0
    i = int(i)
    while i//10 > 0:
        var_e = var_e + i%10
        i = i//10
    var_e = var_e + i%10
    list_c.append(var_e)
var_f = 19
var_g = 0
var_f = int(var_f)
for i in list_c:
    i = int(i)
    if i == var_f:
        var_g = var_g + 1
print(int(var_g))
Category: Geometry

Question (EN): How many vertices does the cube have?
Question (KO): 정육면체의 꼭지점의 개수는?

Answer: 8

Solution (Python):
var_a = 6
var_b = 2
var_c = var_a - var_b
var_d = 2
var_e = var_c * var_d
print(int(var_e))
Category: Possibility

Question (EN): Write the largest two-digit number that can be formed by drawing two different numbers from 1, 2, 4, and 6.
Question (KO): 1, 2, 4, 6 중에서 서로 다른 숫자 2개를 뽑아 만들 수 있는 두 자리 수 중에서 가장 큰 수를 쓰시오.

Answer: 64

Solution (Python):
var_a = 1
var_b = 2
var_c = 4
var_d = 6
list_a= []
if "/" in str(var_d):
    var_d = eval(str(var_d))
list_a.append(var_d)
if "/" in str(var_c):
    var_c = eval(str(var_c))
list_a.append(var_c)
if "/" in str(var_b):
    var_b = eval(str(var_b))
list_a.append(var_b)
if "/" in str(var_a):
    var_a = eval(str(var_a))
list_a.append(var_a)
list_a.reverse()
var_e = 2
list_b = [str(i) for i in list_a]
list_b = list(itertools.permutations(list_b, var_e))
list_b = [''.join(num_list) for num_list in list_b]
list_b = [str_num for str_num in list_b if str_num[0] != '0']
list_b = [float(i) for i in list_b]
var_f = 1
list_c=list_b.copy()
list_c.sort()
var_g = list_c[-var_f]
print(int(var_g))
Category: Arithmetic calculation

Question (EN): Hyeoncheol bought jelly with half of the money he had, and candy with half of the money he had left. If the remaining money was 1250 won, how much money did Hyuncheol have at the beginning?
Question (KO): 현철이는 가진 돈의 절반으로 젤리를 사고, 남은 돈의 절반으로 사탕을 샀습니다. 남은 돈이 1250원이었다면, 처음에 현철이가 가지고 있던 돈을 얼마일까요?

Answer: 5000

Solution (Python):
var_a = 1250
var_b = 2
var_c = var_a * var_b
var_d = 2
var_e = var_c * var_d
print(int(var_e))
Category: Geometry

Question (EN): If the circumference of a rectangular book is 100 centimeters (cm) and the width is 20 centimeters (cm) when viewed from the front, what is the length of this book?
Question (KO): 직사각형 모양의 책을 정면에서 봤을 때 둘레는 100센티미터(㎝)이고, 가로의 길이는 20센티미터(㎝)라면, 이 책의 세로의 길이는 얼마일지 구하시오.

Answer: 30

Solution (Python):
var_a = 100
var_b = 2
var_c = var_a / var_b
var_d = 20
var_e = var_c - var_d
print(int(var_e))
Category: Arithmetic calculation

Question (EN): You sold 40 toys on Day 1. On Day 2, you sold 4 times the number of toys sold on Day 1. Find out the number of toys you sold more on Day 2 compared to Day 1.
Question (KO): 1번째 날 장난감을 40개 팔았습니다. 2번째 날에는 1번째 날에 판 장난감 수의 4배만큼 팔았습니다. 2번째 날 판 장난감은 1번째 날 판 장난감보다 몇 개 더 많습니까?

Answer: 120

Solution (Python):
var_a = 40
var_b = 4
var_c = var_a * var_b
var_d = 40
var_e = var_c - var_d
print(int(var_e))
Category: Arithmetic calculation

Question (EN): Among the students in Jimin's class, 38 students like Korean, 39 students like math, and 32 students like both Korean and math. If there is no student who does not like both Korean and math, how many students are in Jimin's class?
Question (KO): 지민이네 반 학생 중에서 국어를 좋아하는 학생은 38명이고, 수학을 좋아하는 학생은 39명이고, 국어와 수학을 모두 좋아하는 학생은 32명입니다. 국어와 수학을 모두 좋아하지 않는 학생이 한 명도 없을 때, 지민이네 반 학생은 모두 몇 명입니까?

Answer: 45

Solution (Python):
var_a = 38
var_b = 39
var_c = var_a + var_b
var_d = 32
var_e = var_c - var_d
print(int(var_e))
Category: Correspondence

Question (EN): Dividing a certain number by 4, adding 25, and multiplying by 3, results in 150. Find the certain number.
Question (KO): 어떤 수를 4로 나누고 25를 더한 뒤 3을 곱하였더니 150이 되었습니다. 어떤 수를 구하시오.

Answer: 100

Solution (Python):
var_a = 150
var_b = 3
var_c = var_a / var_b
var_d = 25
var_e = var_c - var_d
var_f = 4
var_g = var_e * var_f
print(int(var_g))
Category: Comparison

Question (EN): 20 students stood in a line. Jungkook is in line for first place, and there are 5 students between Yoongi and Jungkook. How many students are standing behind Yoongi?
Question (KO): 20명의 학생들이 한줄로 섰습니다. 정국이는 1등으로 줄을 섰고, 윤기와 정국이 사이에는 5명의 학생이 있습니다. 윤기 뒤에 서 있는 학생은 몇 명입니까?

Answer: 13

Solution (Python):
var_a = 20
var_b = 1
var_c = var_a - var_b
var_d = 5
var_e = var_c - var_d
var_f = 1
var_g = var_e - var_f
print(int(var_g))
Category: Geometry

Question (EN): Young-jin arranged all the 10-won coins in his possession in a regular manner to form a square. If the number of coins placed around is 96, how much money does Young-jin have?
Question (KO): 영진이는 가지고 있는 10원짜리 동전 전부를 빈틈없이 규칙적으로 늘어놓아 정사각형을 만들었습니다. 둘레에 놓인 동전의 개수가 96개였다면, 영진이가 가지고 있는 돈은 모두 얼마입니까?

Answer: 6250

Solution (Python):
var_a = 96
var_b = 4
var_c = var_a + var_b
var_d = 4
var_e = var_c / var_d
var_f = 2
var_g = var_e ** var_f
var_h = 10
var_i = var_g * var_h
print(int(var_i))
Category: Correspondence

Question (EN): A is a single-digit number. Rounding down A27 from the hundreds place results in 200. What is A?
Question (KO): A는 한 자리 수입니다. 백의 자리에서 A27을 버림하면 200이 됩니다. A는 무엇입니까?

Answer: 2

Solution (Python):
var_a = 'A27'
ans_dict = dict()
var_a = str(var_a)
list_a = []
variable_candi = set(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'])
for v in set(var_a):
    if v in variable_candi:
        ans_dict[v] = 0
candi = list(itertools.product('0123456789', repeat=len(ans_dict)))
for c in candi:
    temp = var_a
    for i, (k, _) in enumerate(ans_dict.items()):
        temp = temp.replace(k, str(c[i]))
    if len(var_a) == len(str(int(temp))):
        new_elem = int(temp)
        list_a.append(new_elem)
var_b = 200
list_b = []
for i in list_a:
    if i >= var_b:
        list_b.append(i)
var_c = 200
var_d = 100
var_e = var_c + var_d
list_c = []
for i in list_b:
    if i < var_e:
        list_c.append(i)
var_f = 'A'
var_a = str(var_a)
var_f = str(var_f)
unk_idx = var_a.index(var_f)
var_g = 0
for elem in list_c:
    elem = str(elem)
    var_g = int(elem[unk_idx])
print(int(var_g))
Category: Arithmetic calculation

Question (EN): If you hand out 24 apples and 36 tangerines equally to many students as possible, how many students can you give?
Question (KO): 사과 24개와 귤 36개를 최대한 많은 학생에게 똑같이 나눠줄 때, 몇 명의 학생에게 나누어 줄 수 있는지 구하시오.

Answer: 12

Solution (Python):
var_a = 24
list_a = []
num_sqrt = int(math.sqrt(var_a))
for i in range(1, num_sqrt+1):
    if var_a % i == 0:
        list_a.append(i)
        list_a.append(int(var_a/i))
list_a = sorted(set(list_a))
var_b = 36
list_b = []
num_sqrt = int(math.sqrt(var_b))
for i in range(1, num_sqrt+1):
    if var_b % i == 0:
        list_b.append(i)
        list_b.append(int(var_b/i))
list_b = sorted(set(list_b))
list_c = list(set(list_a) & set(list_b))
var_c = 1
list_d=list_c.copy()
list_d.sort()
var_d = list_d[-var_c]
print(int(var_d))
Category: Geometry

Question (EN): What is the diameter in centimeters (cm) of a solid figure obtained by rotating a semicircle with a radius of 4 centimeters (cm) once around its diameter?
Question (KO): 반지름이 4센티미터(㎝)인 반원을 지름을 기준으로 하여 한 번 돌려 얻는 입체도형의 지름은 몇 센티미터(㎝)입니까?

Answer: 8

Solution (Python):
var_a = 4
var_b = 2
var_c = var_a * var_b
print(int(var_c))
Category: Comparison

Question (EN): Eunji is standing in the 8th column from the left, the 14th column from the right, the 7th row from the front, and the 15th row from the back and doing gymnastics. If the number of students standing in each row is the same, how many students are doing gymnastics?
Question (KO): 은지는 왼쪽에서 8번째 열, 오른쪽에서 14번째 열, 앞에서 7번째 줄, 뒤에서 15번째 줄에 서서 체조를 하고 있습니다. 각 줄마다 서 있는 학생의 수가 같다고 할 때, 체조를 하고 있는 학생은 모두 몇 명입니까?

Answer: 441

Solution (Python):
var_a = 8
var_b = 14
var_c = var_a + var_b
var_d = 1
var_e = var_c - var_d
var_f = 7
var_g = 15
var_h = var_f + var_g
var_i = 1
var_j = var_h - var_i
var_k = var_e * var_j
print(int(var_k))
Category: Arithmetic calculation

Question (EN): There are four numbers 10, 11, 12, and 13. What do you get if you multiply the smallest number by the second smallest number?
Question (KO): 4개의 수 10, 11, 12, 13이 있습니다. 그 중에서 가장 작은 수와 2번째로 작은 수의 곱은 얼마입니까?

Answer: 110

Solution (Python):
var_a = 10
var_b = 11
var_c = 12
var_d = 13
list_a= []
if "/" in str(var_d):
    var_d = eval(str(var_d))
list_a.append(var_d)
if "/" in str(var_c):
    var_c = eval(str(var_c))
list_a.append(var_c)
if "/" in str(var_b):
    var_b = eval(str(var_b))
list_a.append(var_b)
if "/" in str(var_a):
    var_a = eval(str(var_a))
list_a.append(var_a)
list_a.reverse()
var_e = 1
list_b=list_a.copy()
list_b.sort()
var_f = list_b[var_e-1]
var_g = 2
list_c=list_a.copy()
list_c.sort()
var_h = list_c[var_g-1]
var_i = var_f * var_h
print(int(var_i))
Category: Comparison

Question (EN): Given that Taehyung, Minju, Sangmin, Yoonjung, and Yoojung crossed the end line of the race, who got in first?
Question (KO): 태형, 민주, 상민, 윤정, 유정이 차례로 결승선을 통과하였다. 누가 가장 먼저 들어왔나?

Answer: Taehyung

Solution (Python):
var_a = 'Taehyung'
var_b = 'Minju'
var_c = 'Sangmin'
var_d = 'Yoonjung'
var_e = 'Yoojung'
list_a= []
if "/" in str(var_e):
    var_e = eval(str(var_e))
list_a.append(var_e)
if "/" in str(var_d):
    var_d = eval(str(var_d))
list_a.append(var_d)
if "/" in str(var_c):
    var_c = eval(str(var_c))
list_a.append(var_c)
if "/" in str(var_b):
    var_b = eval(str(var_b))
list_a.append(var_b)
if "/" in str(var_a):
    var_a = eval(str(var_a))
list_a.append(var_a)
list_a.reverse()
var_f = 1
var_g = list_a[var_f-1]
print(var_g)
Category: Correspondence

Question (EN): When 14 is divided by 3, the quotient is A and the remainder is 2. Find A.
Question (KO): 14를 3로 나눴더니 몫이 A가 되었고, 나머지는 2가 되었습니다. 이 때 A를 구하시오.

Answer: 4

Solution (Python):
var_a = 14
var_b = 2
var_c = var_a - var_b
var_d = 3
var_e = var_c / var_d
print(int(var_e))
Category: Geometry

Question (EN): For line segment AB with a length of 12 centimeters (cm), if point M is the midpoint of line segment AB and point N is the midpoint of line segment AM, find the length of segment NM.
Question (KO): 길이가 12센티미터(㎝)인 선분 AB에 대하여 점 M은 선분 AB의 중점이고, 점 N은 선분 AM의 중점일 때, 선분 NM의 길이를 구하시오.

Answer: 3

Solution (Python):
var_a = 12
var_b = 2
var_c = var_a / var_b
var_d = 2
var_e = var_c / var_d
print(int(var_e))
Category: Correspondence

Question (EN): I added 36 to a number and it resulted in 71. Find the result of adding 10 to the number.
Question (KO): 어떤 수에 36을 더했더니 71이 되었습니다. 어떤 수에 10을 더하면 얼마가 되는지 구하시오.

Answer: 45

Solution (Python):
var_a = 71
var_b = 36
var_c = var_a - var_b
var_d = 10
var_e = var_c + var_d
print(int(var_e))
Category: Geometry

Question (EN): It is said that a polygon can draw one diagonal from one vertex. Find the number of sides of this polygon.
Question (KO): 어떤 다각형은 한 꼭짓점에서 1개의 대각선을 그을 수 있다고 합니다. 이 다각형의 변의 개수를 구하시오.

Answer: 4

Solution (Python):
var_a = 1
var_b = 3
var_c = var_a + var_b
print(int(var_c))
Category: Geometry

Question (EN): A rectangle is 5/6 meters (m) wide and 4/6 meters (m) long. How many meters (m) longer is the width of this rectangle than its length?
Question (KO): 가로가 5/6미터(m), 세로가 4/6미터(m)인 직사각형이 있습니다. 이 직사각형의 가로는 세로보다 몇 미터(m)더 깁니까?

Answer: 0.17

Solution (Python):
var_a = 0.8333333333333334
var_b = 0.6666666666666666
var_c = var_a - var_b
print('{:.2f}'.format(round(var_c+1e-10,2)))
Category: Arithmetic calculation

Question (EN): The museum has 500 paintings. If all pictures are numbered from 1 to 500 in order, find how many times the number 4 is written in each picture.
Question (KO): 어느 박물관에 500개의 그림이 있습니다. 모든 그림에는 1부터 500까지의 번호가 차례로 적혀있을 때, 숫자 4는 모두 몇 번 적혀 있는지 구하시오.

Answer: 200

Solution (Python):
var_a = 1
var_b = 500
var_c = 1
list_a = [i for i in range(var_a, var_b + 1, var_c)]
var_d=""
for i in list_a:
    i = str(i)
    var_d = var_d + i
list_b = []
var_d = int(var_d)
while var_d//10 > 0:
    list_b.append(var_d%10)
    var_d = var_d//10
list_b.append(var_d%10)
list_b = list_b[::-1]
var_e = 4
var_f = 0
var_e = int(var_e)
for i in list_b:
    i = int(i)
    if i == var_e:
        var_f = var_f + 1
print(int(var_f))
Category: Arithmetic calculation

Question (EN): 58 people got off at the train's first stop and 37 got on at the next station. If there were 123 people on the train at first, how many people are still left?
Question (KO): 기차의 첫번째 정차역에서 58명이 내리고 다음 역에서 37명이 탔습니다. 처음 기차에 있던 사람이 123명 일 때, 현재 남아 있는 사람을 몇 명입니까?

Answer: 102

Solution (Python):
var_a = 123
var_b = 58
var_c = var_a - var_b
var_d = 37
var_e = var_c + var_d
print(int(var_e))
Category: Arithmetic calculation

Question (EN): There is a bag that is 5 meters (m) long and weighs 29/8 kilograms (kg) and a chair that is 4 meters (m) long and weighs 2.8 kilograms (kg). How many kilograms (kg) are the bag and chair if they are cut into 2 meters (m) and weighed together?
Question (KO): 길이가 5미터(m), 무게가 29/8킬로그램(㎏)의 가방과 길이가 4미터(m), 무게가 2.8킬로그램(㎏)인 의자가 있다. 가방과 의자를 2미터(m)씩 잘라 함께 무게를 재면 몇 킬로그램(㎏)입니까?

Answer: 2.85

Solution (Python):
var_a = 3.625
var_b = 5
var_c = var_a / var_b
var_d = 2
var_e = var_c * var_d
var_f = 2.8
var_g = 4
var_h = var_f / var_g
var_i = 2
var_j = var_h * var_i
var_k = var_e + var_j
print('{:.2f}'.format(round(var_k+1e-10,2)))
Category: Arithmetic calculation

Question (EN): Seven years ago, the father's age was three times the son's age. Eight years from this year, the sum of the ages of father and son will be 74. How old is the father after 8 years from now?
Question (KO): 7년 전에 아버지 나이는 아들 나이의 3배였습니다. 올해부터 8년 후에 아버지와 아들의 나이 합은 74살이 됩니다. 8년 후의 아버지 나이는 몇 살입니까?

Answer: 48

Solution (Python):
var_a = 74
var_b = 8
var_c = 2
var_d = var_b * var_c
var_e = var_a - var_d
var_f = 7
var_g = 2
var_h = var_f * var_g
var_i = var_e - var_h
var_j = 3
var_k = 1
var_l = var_j + var_k
var_m = var_i // var_l
var_n = 3
var_o = var_m * var_n
var_p = 7
var_q = var_o + var_p
var_r = 8
var_s = var_q + var_r
print(int(var_s))
Category: Arithmetic calculation

Question (EN): Seokjin's Korean score is 93 points, and his English score is 91 points. If the average score of Korean, English, and Math is 89, what is his math score?
Question (KO): 석진이의 국어 점수는 93점이고, 영어 점수는 91점입니다. 국어, 영어, 수학 세 과목의 평균 점수가 89점일 때, 수학 점수는 몇 점입니까?

Answer: 83

Solution (Python):
var_a = 89
var_b = 3
var_c = var_a * var_b
var_d = 93
var_e = var_c - var_d
var_f = 91
var_g = var_e - var_f
print(int(var_g))
Category: Arithmetic calculation

Question (EN): I tried to hand out 98 tangerines equally to 12 people, but a few tangerines were short. I want to buy a few more tangerines so that I can hand them out equally. If the price of one tangerine is 450 won, at least how much more do I need?
Question (KO): 98개의 귤을 12명에게 똑같이 나누어 주려고 하였더니 몇 개가 모자랐습니다. 귤을 남김없이 똑같이 나누어 주기 위해 귤을 몇 개 더 사려고 합니다. 귤 한 개 가격이 450원 일 때, 최소 얼마가 더 필요합니까?

Answer: 4500

Solution (Python):
var_a = 12
var_b = 98
var_c = 12
var_d = var_b % var_c
var_e = var_a - var_d
var_f = 450
var_g = var_e * var_f
print(int(var_g))
Category: Geometry

Question (EN): A piece of paper is in the shape of a right triangle with a hypotenuse length of 13 and the non-hypotenuse side length of 12. What is the length of the other side?
Question (KO): 빗변의 길이가 13, 빗변이 아닌 한 변의 길이가 12인 직각삼각형 모양의 종이가 있습니다. 나머지 한 변의 길이는 얼마입니까?

Answer: 5

Solution (Python):
var_a = 13
var_b = 2
var_c = var_a ** var_b
var_d = 12
var_e = 2
var_f = var_d ** var_e
var_g = var_c - var_f
var_h = 0.5
var_i = var_g ** var_h
print(int(var_i))
Category: Geometry

Question (EN): If the width of a cube is 12 centimeters (cm), the length is 16 centimeters (cm), and the height is 14 centimeters (cm), find the value of the surface area of the largest cube that can be made by cutting the cube.
Question (KO): 직육면체의 가로가 12센티미터(㎝), 세로가 16센티미터(㎝), 높이가 14센티미터(㎝) 일 때, 이 직육면체를 잘라서 만들 수 있는 가장 큰 정육면체의 겉넓이의 값을 구하시오.

Answer: 864

Solution (Python):
var_a = 12
var_b = 16
var_c = 14
list_a= []
if "/" in str(var_c):
    var_c = eval(str(var_c))
list_a.append(var_c)
if "/" in str(var_b):
    var_b = eval(str(var_b))
list_a.append(var_b)
if "/" in str(var_a):
    var_a = eval(str(var_a))
list_a.append(var_a)
list_a.reverse()
var_d = 1
list_b=list_a.copy()
list_b.sort()
var_e = list_b[var_d-1]
var_f = 2
var_g = var_e ** var_f
var_h = 6
var_i = var_g * var_h
print(int(var_i))
Category: Arithmetic calculation

Question (EN): There are 5 vases. Each of the 5 vases has 4 flowers, and the 6 vases have 1 flower. How many flowers are there in the vase?
Question (KO): 꽃병이 5개 있습니다. 꽃병 5개에는 각각 4송이의 꽃이 있고, 꽃병 6개에는 1개의 꽃이 있습니다. 꽃병에 있는 꽃은 모두 몇 송이입니까?

Answer: 26

Solution (Python):
var_a = 4
var_b = 5
var_c = var_a * var_b
var_d = 1
var_e = 6
var_f = var_d * var_e
var_g = var_c + var_f
print(int(var_g))
Category: Arithmetic calculation

Question (EN): There are buses that depart only when there are more than 15 and no more than 30 people. If there are 9 people on the bus right now, find out how many more people need to get on the bus before it starts.
Question (KO): 15 명 초과 30 명 이하의 사람이 타야 출발하는 버스가 있습니다. 지금 버스에 타고 있는 사람이 9 명이라면 적어도 몇 명이 더 타야 출발할 수 있는지 구하시오.

Answer: 7

Solution (Python):
var_a = 15
var_b = 1
var_c = var_a + var_b
var_d = 9
var_e = var_c - var_d
print(int(var_e))
Category: Correspondence

Question (EN): Cheolsu's weight is 2/3 of his mother's weight, and his father's weight is 72 kilograms (kg). If the sum of Cheolsu's and his father's weight is equal to twice the mother's weight, find how many kilograms (kg) Cheolsu weighs.
Question (KO): 철수의 몸무게는 어머니의 몸무게의 2/3이고, 아버지의 몸무게는 72킬로그램(㎏)입니다. 철수와 아버지의 몸무게의 합이 어머니의 몸무게의 2배와 같을 때, 철수의 몸무게는 몇 킬로그램(㎏)인지 구하시오.

Answer: 36

Solution (Python):
var_a = 72
var_b = 2
var_c = 1
var_d = 0.6666666666666666
var_e = var_c / var_d
var_f = var_b * var_e
var_g = 1
var_h = var_f - var_g
var_i = var_a / var_h
print(int(var_i))
Category: Correspondence

Question (EN): I mistakenly added 0.42 which should have subtracted from a number, and I ended up with 0.9. How much would it be if I counted correctly?
Question (KO): 어떤 수에서 0.42 를 빼야 할 것을 잘못하여 더했더니 0.9 이 되었습니다. 바르게 계산하면 얼마가 되겠습니까?

Answer: 0.06

Solution (Python):
var_a = 0.9
var_b = 0.42
var_c = var_a - var_b
var_d = 0.42
var_e = var_c - var_d
print('{:.2f}'.format(round(var_e+1e-10,2)))
Category: Correspondence

Question (EN): We have the expression 14A+2B3=418. Find the number that goes into B.
Question (KO): 식 14A+2B3=418이 있습니다. B에 들어가야 하는 숫자를 구하시오

Answer: 7

Solution (Python):
var_a = '14A+2B3=418'
var_b = 'B'
ans_dict = dict()
var_a = var_a.replace('×','*')
var_a = var_a.replace('x','*')
var_a = var_a.replace('÷','/')
variable_candi = set(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'])
for v in set(var_a):
    if v in variable_candi:
        ans_dict[v] = 1
candi = list(itertools.product('0123456789', repeat=len(ans_dict)))
for c in candi:
    temp = var_a
    for i, (k, _) in enumerate(ans_dict.items()):
        temp = temp.replace(k, str(c[i]))
    term_list = []
    op_list = []
    temp_c = ''
    for tc in temp:
        if tc not in '+-*/=><().':
            temp_c += tc
        else:
            op_list.append(tc)
            term_list.append(temp_c)
            temp_c = ''
    term_list.append(temp_c)
    new_eq = ''
    for i in range(len(op_list)):
        new_eq += str(int(term_list[i]))+op_list[i]
    new_eq += str(int(term_list[-1]))
    if len(new_eq) == len(var_a):
        new_eq=new_eq.replace('=', '==')
        new_eq=new_eq.replace('>==', '>=')
        new_eq=new_eq.replace('<==', '<=')
        eval_result = False
        try:
            eval_result = eval(new_eq)
        except:
            pass
        if eval_result:
            for i, (k, _) in enumerate(ans_dict.items()):
                ans_dict[k] = int(c[i])
var_c = ans_dict[var_b]
print(int(var_c))
Category: Possibility

Question (EN): How many ways can 19 be expressed as the sum of four different natural numbers?
Question (KO): 19를 네 개의 다른 자연수의 합으로 표현할 수 있는 방법은 몇 가지입니까?

Answer: 264

Solution (Python):
var_a = 1
var_b = 9
var_c = 1
list_a = [i for i in range(var_a, var_b + 1, var_c)]
var_d = 4
list_b = [str(i) for i in list_a]
list_b = list(itertools.permutations(list_b, var_d))
list_b = [''.join(num_list) for num_list in list_b]
list_b = [str_num for str_num in list_b if str_num[0] != '0']
list_b = [float(i) for i in list_b]
list_c=[]
for i in list_b:
    var_e = 0
    i = int(i)
    while i//10 > 0:
        var_e = var_e + i%10
        i = i//10
    var_e = var_e + i%10
    list_c.append(var_e)
var_f = 19
var_g = 0
var_f = int(var_f)
for i in list_c:
    i = int(i)
    if i == var_f:
        var_g = var_g + 1
print(int(var_g))
Category: Arithmetic calculation

Question (EN): This year, the age of the mother is four times the age of the son. Three years ago, the combined ages of mother and son were 49. How old is her son this year?
Question (KO): 올해 어머니 나이는 아들 나이의 4배입니다. 3년 전에 어머니와 아들의 나이의 합은 49살이었습니다. 올해 아들의 나이는 몇 살입니까?

Answer: 11

Solution (Python):
var_a = 49
var_b = 3
var_c = 2
var_d = var_b * var_c
var_e = var_a + var_d
var_f = 1
var_g = 4
var_h = var_f + var_g
var_i = var_e / var_h
print(int(var_i))
Category: Geometry

Question (EN): A cube was cut to make 27 cubes with each edge being 4 centimeters (cm) long. Find the surface area of the original cube in square centimeters (cm2).
Question (KO): 어떤 정육면체를 잘라서 한 모서리의 길이가 4센티미터(㎝)인 정육면체 27개를 만들었다. 자르기 전의 정육면체의 겉넓이는 몇 제곱센티미터(㎠)인지 구하시오.

Answer: 864

Solution (Python):
var_a = 4
var_b = 27
var_c = 1
var_d = 3
var_e = var_c / var_d
var_f = var_b ** var_e
var_g = var_a * var_f
var_h = 2
var_i = var_g ** var_h
var_j = 6
var_k = var_i * var_j
print(int(var_k))
Category: Possibility

Question (EN): There is a three-digit number made of 5, 9, and 2. When the difference between the two possible numbers is the greatest, which of the two numbers is smaller?
Question (KO): 5, 9, 2 중에서 한 번씩만 사용하여 세 자리 수를 만들려고 합니다. 만든 두 수의 차가 가장 크게 될 때, 두 수 중 작은 수는 무엇입니까?

Answer: 259

Solution (Python):
var_a = 5
var_b = 9
var_c = 2
list_a= []
if "/" in str(var_c):
    var_c = eval(str(var_c))
list_a.append(var_c)
if "/" in str(var_b):
    var_b = eval(str(var_b))
list_a.append(var_b)
if "/" in str(var_a):
    var_a = eval(str(var_a))
list_a.append(var_a)
list_a.reverse()
var_d = 3
list_b = [str(i) for i in list_a]
list_b = list(itertools.permutations(list_b, var_d))
list_b = [''.join(num_list) for num_list in list_b]
list_b = [str_num for str_num in list_b if str_num[0] != '0']
list_b = [float(i) for i in list_b]
var_e = 1
list_c=list_b.copy()
list_c.sort()
var_f = list_c[var_e-1]
print(int(var_f))