category
stringclasses
5 values
question
stringlengths
20
555
answer
stringlengths
1
20
solution_abst
stringlengths
1
287
solution_code
stringlengths
27
5.97k
Comparison
Students stand in a line. 4 people are standing in front of Seokjin, and 7 people are standing behind Jimin. When Jimin is behind Seokjin, three people stand between Seokjin and Jimin. How many students are standing in line?
16
4 7 [OP_ADD] 3 [OP_ADD] 2 [OP_ADD]
var_a = 4 var_b = 7 var_c = var_a + var_b var_d = 3 var_e = var_c + var_d var_f = 2 var_g = var_e + var_f print(int(var_g))
Geometry
After selecting a point inside a polygon and drawing lines connecting it to the rest of the vertices, 20 triangles were created. Find the number of diagonals of this polygon.
170
20 20 3 [OP_SUB] [OP_MUL] 2 [OP_DIV]
var_a = 20 var_b = 20 var_c = 3 var_d = var_b - var_c var_e = var_a * var_d var_f = 2 var_g = var_e / var_f print(int(var_g))
Arithmetic calculation
After school, I rode my bike quickly to the academy, and it measured 15 kilometers (km) per hour. I rode at 10 kilometers (km) per hour to get back to school to pick up books after the academy, and it took another 30 minutes longer. How many kilometers (km) is the distance between the school and the academy?
15
30 60 [OP_DIV] 1 10 [OP_DIV] 1 15 [OP_DIV] [OP_SUB] [OP_DIV]
var_a = 30 var_b = 60 var_c = var_a / var_b var_d = 1 var_e = 10 var_f = var_d / var_e var_g = 1 var_h = 15 var_i = var_g / var_h var_j = var_f - var_i var_k = var_c / var_j print(int(eval('{:.2f}'.format(round(var_k+1e-10,2)))))
Comparison
What is the sum of all the numbers greater than 0.4 among 0.8, 1/2, and 0.9?
2.2
[OP_LIST_SOL] 0.8 1/2 0.9 [OP_LIST_EOL] 0.4 [OP_LIST_MORE] [OP_LIST_SUM]
var_a = 0.8 var_b = 0.5 var_c = 0.9 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 = 0.4 list_b = [] for i in list_a: if i > var_d: list_b.append(i) list_b = [float(i) for i in list_b] var_e = sum(list_b) print('{:.2f}'.format(round(var_e+1e-10,2)))
Possibility
You want to divide 20 apples into 2 different baskets. There should be at least 1 apple in the basket. How many ways are possible to divide apples?
19
20 2 [OP_SUB] 1 [OP_ADD]
var_a = 20 var_b = 2 var_c = var_a - var_b var_d = 1 var_e = var_c + var_d print(int(var_e))
Geometry
Find the area in square centimeters (cm2) of a rectangle with a perimeter of 56 centimeters (cm) and a width of 16 centimeters (cm).
192
56 2 [OP_DIV] 16 [OP_SUB] 16 [OP_MUL]
var_a = 56 var_b = 2 var_c = var_a / var_b var_d = 16 var_e = var_c - var_d var_f = 16 var_g = var_e * var_f print(int(var_g))
Comparison
The rabbit and tortoise had a race. During the same amount of time, the rabbit ran one hundredth of 10.2 kilometers (km), and the tortoise ran 100 meters (m). Who ran more?
rabbit
[OP_LIST_SOL] rabbit tortoise [OP_LIST_EOL] [OP_LIST_SOL] 10.2 1000 [OP_MUL] 100 [OP_DIV] 100 [OP_LIST_EOL] 1 [OP_LIST_MAX] [OP_LIST_INDEX] [OP_LIST_POP] [OP_LIST_GET]
var_a = 'rabbit' var_b = 'tortoise' list_a= [] 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_c = 10.2 var_d = 1000 var_e = var_c * var_d var_f = 100 var_g = var_e / var_f var_h = 100 list_b= [] if "/" in str(var_h): var_h = eval(str(var_h)) list_b.append(var_h) if "/" in str(var_g): var_g = eval(str(var_g)) list_b.append(var_g) list_b.reverse() var_i = 1 list_c=list_b.copy() list_c.sort() var_j = list_c[-var_i] var_k = list_b.index(var_j)+1 var_l = list_a[var_k-1] print(var_l)
Arithmetic calculation
You want to make no dolls left after handing out dolls equally to 8 students. When there are 62 dolls, how many more dolls do you need at least?
2
62 8 [OP_MOD] 8 [OP_SUB] [OP_ABS]
var_a = 62 var_b = 8 var_c = var_a % var_b var_d = 8 var_e = var_c - var_d var_f = abs(var_e) print(int(var_f))
Comparison
Find the product of the largest number and the smallest number among 0.34, 2/4, 9/11, 0.22, and 0.76.
0.18
[OP_LIST_SOL] 0.34 2/4 9/11 0.22 0.76 [OP_LIST_EOL] 1 [OP_LIST_MAX] 1 [OP_LIST_MIN] [OP_MUL]
var_a = 0.34 var_b = 0.5 var_c = 0.8181818181818182 var_d = 0.22 var_e = 0.76 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 list_b=list_a.copy() list_b.sort() var_g = list_b[-var_f] var_h = 1 list_c=list_a.copy() list_c.sort() var_i = list_c[var_h-1] var_j = var_g * var_i print('{:.2f}'.format(round(var_j+1e-10,2)))
Arithmetic calculation
There are five numbers 10, 11, 12, 13, and 14. What is the value of difference between the 3rd smallest number and the 2nd smallest number?
1
[OP_LIST_SOL] 10 11 12 13 14 [OP_LIST_EOL] 3 [OP_LIST_MIN] 2 [OP_LIST_MIN] [OP_SUB]
var_a = 10 var_b = 11 var_c = 12 var_d = 13 var_e = 14 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 = 3 list_b=list_a.copy() list_b.sort() var_g = list_b[var_f-1] var_h = 2 list_c=list_a.copy() list_c.sort() var_i = list_c[var_h-1] var_j = var_g - var_i print(int(var_j))
Correspondence
Suyeong goes shopping and uses 3/8 of her money at the first store, 1/3 of the remaining money at the second store, and 4/5 of the remaining money at the third store. The money was 1200 won. Find how much money Sooyoung had at first.
14400
1200 1 4/5 [OP_SUB] [OP_DIV] 1 1/3 [OP_SUB] [OP_DIV] 1 3/8 [OP_SUB] [OP_DIV]
var_a = 1200 var_b = 1 var_c = 0.8 var_d = var_b - var_c var_e = var_a / var_d var_f = 1 var_g = 0.3333333333333333 var_h = var_f - var_g var_i = var_e / var_h var_j = 1 var_k = 0.375 var_l = var_j - var_k var_m = var_i / var_l print(int(var_m))
Geometry
What is the length of the radius of a circle with an area equal to the surface area of a sphere with a radius of 3 centimeters (cm)?
6
4 3 2 [OP_POW] [OP_MUL] 1/2 [OP_POW]
var_a = 4 var_b = 3 var_c = 2 var_d = var_b ** var_c var_e = var_a * var_d var_f = 0.5 var_g = var_e ** var_f print(int(var_g))
Correspondence
When 4A+B3=68, what number should go into A, when 4A and B3 is two-digit number?
5
4A+B3=68 A [OP_DIGIT_UNK_SOLVER]
var_a = '4A+B3=68' var_b = 'A' 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))
Geometry
There is a cube with the sum of the lengths of all its edges equal to 96 centimeters (cm). How many centimeters (cm) is the length of one edge of this cube?
8
96 12 [OP_DIV]
var_a = 96 var_b = 12 var_c = var_a / var_b print(int(var_c))
Arithmetic calculation
Taehyung's class has 3 more students than Jimin's class, and Jimin's class has 2 fewer students than Seokjin's class. If there are 35 students in Taehyung's class, how many students are in Seokjin's class?
34
35 3 [OP_SUB] 2 [OP_ADD]
var_a = 35 var_b = 3 var_c = var_a - var_b var_d = 2 var_e = var_c + var_d print(int(var_e))
Arithmetic calculation
There are five numbers 10, 11, 12, 13, and 14. What is the remainder of the 2nd largest number divided by the 3rd largest number?
12
[OP_LIST_SOL] 10 11 12 13 14 [OP_LIST_EOL] 3 [OP_LIST_MAX] 2 [OP_LIST_MAX] [OP_MOD]
var_a = 10 var_b = 11 var_c = 12 var_d = 13 var_e = 14 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 = 3 list_b=list_a.copy() list_b.sort() var_g = list_b[-var_f] var_h = 2 list_c=list_a.copy() list_c.sort() var_i = list_c[-var_h] var_j = var_g % var_i print(int(var_j))
Arithmetic calculation
There is flour in the box. When the box full of flour was weighed, it was 3.4 kilograms (kg), and after using 1/5 of the flour, the box is weighed again and it was 2.98 kilograms (kg). Find the weight of the empty box.
1.3
3.4 3.4 2.98 [OP_SUB] 1/5 [OP_DIV] [OP_SUB]
var_a = 3.4 var_b = 3.4 var_c = 2.98 var_d = var_b - var_c var_e = 0.2 var_f = var_d / var_e var_g = var_a - var_f print('{:.2f}'.format(round(var_g+1e-10,2)))
Geometry
Jung-min bought wire at a stationery store to make a regular pentagon with a side length of 13 centimeters (cm). After making a regular pentagon with this wire, only 8 centimeters (cm) of wire was left. How many centimeters (cm) of wire did Jung-min buy at the store?
73
13 5 [OP_MUL] 8 [OP_ADD]
var_a = 13 var_b = 5 var_c = var_a * var_b var_d = 8 var_e = var_c + var_d print(int(var_e))
Geometry
How many diagonals does an octagon have?
20
8 8 3 [OP_SUB] [OP_MUL] 2 [OP_DIV]
var_a = 8 var_b = 8 var_c = 3 var_d = var_b - var_c var_e = var_a * var_d var_f = 2 var_g = var_e / var_f print(int(var_g))
Arithmetic calculation
There were some coins in the box. After a while, I put 8 more coins in the box, and there are 29 coins in total. How many coins were in the first place?
21
29 8 [OP_SUB]
var_a = 29 var_b = 8 var_c = var_a - var_b print(int(var_c))
Comparison
Ten people of different heights stand in a line in order, starting with the shortest. Yoojung is standing at the 4th from the front. If the line is organized in order from the tallest, what place does Yoojung take in the line?
7
10 4 [OP_SUB] 1 [OP_ADD]
var_a = 10 var_b = 4 var_c = var_a - var_b var_d = 1 var_e = var_c + var_d print(int(var_e))
Arithmetic calculation
There is a box weighing 11.14 kilograms (kg). If there are 14 fans in the box, and the empty box weighs 0.5 kilograms (kg), how many kilograms (kg) does one fan weigh?
0.76
11.14 0.5 [OP_SUB] 14 [OP_DIV]
var_a = 11.14 var_b = 0.5 var_c = var_a - var_b var_d = 14 var_e = var_c / var_d print('{:.2f}'.format(round(var_e+1e-10,2)))
Arithmetic calculation
Yuna solved 8 English questions a day. How many English questions did Yuna solve in 7 days?
56
7 8 [OP_MUL]
var_a = 7 var_b = 8 var_c = var_a * var_b print(int(var_c))
Possibility
Two different numbers will be used as numerator and denominator, respectively. How many improper fractions can there be when those numbers are selected from 3, 5, 7, 11, 13, and 17?
15
6 2 [OP_COMB]
var_a = 6 var_b = 2 var_c = 1 var_a = int(var_a) var_b = int(var_b) for i, elem in enumerate(range(var_b)): var_c = var_c * (var_a-i) for i, elem in enumerate(range(var_b)): var_c = var_c / (i+1) print(int(var_c))
Possibility
You want to create a three-digit number from 2, 7, 0, and 9. What is the 5th smallest of them?
290
[OP_LIST_SOL] 2 7 0 9 [OP_LIST_EOL] 3 [OP_LIST_GET_PERM] 5 [OP_LIST_MIN]
var_a = 2 var_b = 7 var_c = 0 var_d = 9 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 = 3 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 = 5 list_c=list_b.copy() list_c.sort() var_g = list_c[var_f-1] print(int(var_g))
Correspondence
You incorrectly multiplied 2.4 to a number that should have been divided by 2.4 and got 288. What is the correct number?
50
288 2.4 [OP_DIV] 2.4 [OP_DIV]
var_a = 288 var_b = 2.4 var_c = var_a / var_b var_d = 2.4 var_e = var_c / var_d print(int(var_e))
Possibility
You can throw the ball 3 times while playing ball toss. If you hit inside the red circle, you get 3 points, if you hit inside the yellow circle, you get 2 points, and if you don't fit inside the circle, you get 0 points. What is the total number of points you can get?
18
[OP_LIST_SOL] 3 2 0 [OP_LIST_EOL] 3 [OP_LIST_GET_PRODUCT] [OP_LIST_NUM2SUM] [OP_LIST_LEN]
var_a = 3 var_b = 2 var_c = 0 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.product(list_b, repeat=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 = len(list_c) print(int(var_f))
Geometry
A 50 cm (cm) wire was used to make a regular hexagon with a side of 8 cm (cm). If some wire is left over, calculate how much it would have left.
2
50 8 6 [OP_MUL] [OP_SUB]
var_a = 50 var_b = 8 var_c = 6 var_d = var_b * var_c var_e = var_a - var_d print(int(var_e))
Geometry
8 students are gathered in octagonal shapes. Find out how many times all of these students shake hands when they shake hands once except for their neighbors.
20
8 8 3 [OP_SUB] [OP_MUL] 2 [OP_DIV]
var_a = 8 var_b = 8 var_c = 3 var_d = var_b - var_c var_e = var_a * var_d var_f = 2 var_g = var_e / var_f print(int(var_g))
Arithmetic calculation
The production cost of one refrigerator is 450,000 won, and the sales price is 800,000 won. If the sales revenue of this refrigerator is 16.45 million won, how many refrigerators have been sold?
47
1645 80 45 [OP_SUB] [OP_DIV]
var_a = 1645 var_b = 80 var_c = 45 var_d = var_b - var_c var_e = var_a / var_d print(int(var_e))
Geometry
There is a water tank (A) in the shape of a rectangular parallelepiped shape that is 3 centimeters (cm) long, 2 centimeters (cm) wide, and 4 centimeters (cm) high. There is another tank (B) with 4 centimeters (cm) long and 2 centimeters (cm) wide. If you move all the water filled in (B) that was 1.5 centimeters (cm) high into (A), what will be the height of water in (A) in centimeters (cm)?
2
4 2 [OP_MUL] 1.5 [OP_MUL] 3 2 [OP_MUL] [OP_DIV]
var_a = 4 var_b = 2 var_c = var_a * var_b var_d = 1.5 var_e = var_c * var_d var_f = 3 var_g = 2 var_h = var_f * var_g var_i = var_e / var_h print(int(var_i))
Geometry
A cuboid-shaped fish tank with a width of 50 centimeters (cm) and a length of 16 centimeters (cm) was filled with water to a height of 15 centimeters (cm). Here, a cube-shaped object with an edge of 10 centimeters (cm) is completely submerged in the water. Calculate how many centimeters (cm) the height of the water in this fish tank is, including the decimal point.
16.25
15 10 10 [OP_MUL] 10 [OP_MUL] 50 16 [OP_MUL] [OP_DIV] [OP_ADD]
var_a = 15 var_b = 10 var_c = 10 var_d = var_b * var_c var_e = 10 var_f = var_d * var_e var_g = 50 var_h = 16 var_i = var_g * var_h var_j = var_f / var_i var_k = var_a + var_j print('{:.2f}'.format(round(var_k+1e-10,2)))
Geometry
Find the area of a square with one side equal to 30.
900
30 2 [OP_POW]
var_a = 30 var_b = 2 var_c = var_a ** var_b print(int(var_c))
Geometry
Mina has a piece of rectangular-shaped colored paper with one side 5.9 centimeters (cm) long and the other side 3 centimeters (cm) long. What is the area of this piece of paper in square centimeters (cm2)?
17.7
5.9 3 [OP_MUL]
var_a = 5.9 var_b = 3 var_c = var_a * var_b print('{:.2f}'.format(round(var_c+1e-10,2)))
Comparison
Jungkook collected 6 divided by 3 apples, Yoongi collected 4 apples, and Yuna collected 5 apples. Who has the most apples?
Yuna
[OP_LIST_SOL] Jungkook Yoongi Yuna [OP_LIST_EOL] [OP_LIST_SOL] 6 3 [OP_FDIV] 4 5 [OP_LIST_EOL] 1 [OP_LIST_MAX] [OP_LIST_INDEX] [OP_LIST_POP] [OP_LIST_GET]
var_a = 'Jungkook' var_b = 'Yoongi' var_c = 'Yuna' 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 = 6 var_e = 3 var_f = var_d // var_e var_g = 4 var_h = 5 list_b= [] if "/" in str(var_h): var_h = eval(str(var_h)) list_b.append(var_h) if "/" in str(var_g): var_g = eval(str(var_g)) list_b.append(var_g) if "/" in str(var_f): var_f = eval(str(var_f)) list_b.append(var_f) list_b.reverse() var_i = 1 list_c=list_b.copy() list_c.sort() var_j = list_c[-var_i] var_k = list_b.index(var_j)+1 var_l = list_a[var_k-1] print(var_l)
Correspondence
2A3+36=269. What is A?
3
2A3+36=269 A [OP_DIGIT_UNK_SOLVER]
var_a = '2A3+36=269' var_b = 'A' 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))
Possibility
When you try to pick two different numbers out of the six numbers 3, 5, 7, 11, 13, and 17 as the numerator and denominator of one fraction. How many improper fractions can there be?
15
6 2 [OP_COMB]
var_a = 6 var_b = 2 var_c = 1 var_a = int(var_a) var_b = int(var_b) for i, elem in enumerate(range(var_b)): var_c = var_c * (var_a-i) for i, elem in enumerate(range(var_b)): var_c = var_c / (i+1) print(int(var_c))
Arithmetic calculation
Currently, Minjoo's piggy bank has 12,000 won and Siwoo's piggy bank has 4,000 won. If Minjoo puts 300 won a day and Siwoo 500 won a day into their piggy banks tarting tomorrow, after how many days will the money in Minjoo's and Siwoo's piggy banks become the same?
40
12000 4000 [OP_SUB] 500 300 [OP_SUB] [OP_DIV]
var_a = 12000 var_b = 4000 var_c = var_a - var_b var_d = 500 var_e = 300 var_f = var_d - var_e var_g = var_c / var_f print(int(var_g))
Comparison
Seokjin, Hoseok, and Namjoon took a math test. Seokjin's math score is higher than Hoseok's math score, and Namjoon's math score is also higher than Hoseok's math score. If Seokjin's math score is lower than Namjoon's math score, who has the highest math score?
Namjoon
[OP_LIST_SOL] Seokjin Hoseok Namjoon [OP_LIST_EOL] [OP_LIST_SOL] Seokjin Hoseok > Namjoon Hoseok > Seokjin Namjoon < [OP_LIST_EOL] [OP_LIST_COND_MAX_MIN] 1 [OP_LIST_GET]
var_a = 'Seokjin' var_b = 'Hoseok' var_c = 'Namjoon' 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 = 'Seokjin' var_e = 'Hoseok' var_f = '>' var_g = 'Namjoon' var_h = 'Hoseok' var_i = '>' var_j = 'Seokjin' var_k = 'Namjoon' var_l = '<' list_b= [] if "/" in str(var_l): var_l = eval(str(var_l)) list_b.append(var_l) if "/" in str(var_k): var_k = eval(str(var_k)) list_b.append(var_k) if "/" in str(var_j): var_j = eval(str(var_j)) list_b.append(var_j) if "/" in str(var_i): var_i = eval(str(var_i)) list_b.append(var_i) if "/" in str(var_h): var_h = eval(str(var_h)) list_b.append(var_h) if "/" in str(var_g): var_g = eval(str(var_g)) list_b.append(var_g) if "/" in str(var_f): var_f = eval(str(var_f)) list_b.append(var_f) if "/" in str(var_e): var_e = eval(str(var_e)) list_b.append(var_e) if "/" in str(var_d): var_d = eval(str(var_d)) list_b.append(var_d) list_b.reverse() global item_name_index_dict items_name_list = list_a.copy() conditions = [] condition_list = list_b.copy() temp_stack = [] for index_, cond_ in enumerate(map(str, condition_list)): if cond_ in ("<", ">", "="): operand_right = temp_stack.pop() operand_left = temp_stack.pop() if cond_ == "=": cond_ = "==" conditions.append(f"{operand_left} {cond_} {operand_right}") else: if not cond_.isdigit(): cond_ = "{" + cond_ + "}" temp_stack.append(cond_) item_name_index_dict = {} for perm in itertools.permutations(range(1, len(items_name_list) + 1)): item_name_index_dict = dict(zip(items_name_list, perm)) formatted_conditions = \ [condition.format_map(item_name_index_dict) for condition in conditions] if all(map(eval, formatted_conditions)): break list_c = list(item_name_index_dict.keys()) list_c.sort(key=item_name_index_dict.get, reverse=True) var_m = 1 var_n = list_c[var_m-1] print(var_n)
Arithmetic calculation
Eunji received pocket money from her mother and went to the mart to buy a book with 1/4 of the money she took. Consider 1/3 of the remaining money was used to buy snack, and then she got 1,600 won at last. Find out the amount of initial money Eunji took to the mart.
3200
1600 1 1/3 [OP_SUB] [OP_DIV] 1 1/4 [OP_SUB] [OP_DIV]
var_a = 1600 var_b = 1 var_c = 0.3333333333333333 var_d = var_b - var_c var_e = var_a / var_d var_f = 1 var_g = 0.25 var_h = var_f - var_g var_i = var_e / var_h print(int(eval('{:.2f}'.format(round(var_i+1e-10,2)))))
Geometry
If the short diagonal of a rhombus is 6 centimeters (cm) and the long diagonal is 10 centimeters (cm), what is the area of this rhombus?
30
6 10 [OP_MUL] 2 [OP_DIV]
var_a = 6 var_b = 10 var_c = var_a * var_b var_d = 2 var_e = var_c / var_d print(int(var_e))
Arithmetic calculation
Use the three numbers written on cards: 3, 4, and 7 to create a three-digit number. At this time, find the smallest value among the numbers where 4 is in the tens. (However, you cannot use number cards repeatedly.)
347
[OP_LIST_SOL] 3 4 7 [OP_LIST_EOL] 3 [OP_LIST_GET_PERM] 10 4 [OP_LIST_SEARCH_FIXED_DIGIT] 1 [OP_LIST_MIN]
var_a = 3 var_b = 4 var_c = 7 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 = 10 var_f = 4 list_c = [] var_e = int(var_e) var_f = int(var_f) for i in list_b: i = int(i) if (i//var_e)%10 == var_f: list_c.append(i) var_g = 1 list_d=list_c.copy() list_d.sort() var_h = list_d[var_g-1] print(int(var_h))
Possibility
Using the number cards 1, 6, and 8 all once, find the sum of the second largest three-digit number and the third smallest three-digit number.
1434
[OP_LIST_SOL] 1 6 8 [OP_LIST_EOL] 3 [OP_LIST_GET_PERM] 2 [OP_LIST_MAX] 3 [OP_LIST_MIN] [OP_ADD]
var_a = 1 var_b = 6 var_c = 8 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 = 2 list_c=list_b.copy() list_c.sort() var_f = list_c[-var_e] var_g = 3 list_d=list_b.copy() list_d.sort() var_h = list_d[var_g-1] var_i = var_f + var_h print(int(var_i))
Correspondence
Hyunjoong participated in the long march through national land. Hyunjoong walked 1/2 of the total distance until yesterday, and 1/3 of the remaining distance today. If the remaining distance after today is 12 kilometers (km), how many kilometers (km) does Hyunjoong walk in the long march in total?
36
12 1 1/3 [OP_SUB] [OP_DIV] 1 1/2 [OP_SUB] [OP_DIV]
var_a = 12 var_b = 1 var_c = 0.3333333333333333 var_d = var_b - var_c var_e = var_a / var_d var_f = 1 var_g = 0.5 var_h = var_f - var_g var_i = var_e / var_h print(int(eval('{:.2f}'.format(round(var_i+1e-10,2)))))
Possibility
Using 3 of 4, 8, 1, and 2, what is the third smallest number whose tens place is 2?
421
[OP_LIST_SOL] 4 8 1 2 [OP_LIST_EOL] 3 [OP_LIST_GET_PERM] 10 2 [OP_LIST_SEARCH_FIXED_DIGIT] 3 [OP_LIST_MIN]
var_a = 4 var_b = 8 var_c = 1 var_d = 2 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 = 3 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 = 10 var_g = 2 list_c = [] var_f = int(var_f) var_g = int(var_g) for i in list_b: i = int(i) if (i//var_f)%10 == var_g: list_c.append(i) var_h = 3 list_d=list_c.copy() list_d.sort() var_i = list_d[var_h-1] print(int(var_i))
Geometry
Using all of the wire, not overlapping, a regular pentagon with sides of 16 centimeters (cm) was made. How many centimeters (cm) should each side be to make the largest regular octagon with this wire?
10
16 5 [OP_MUL] 8 [OP_DIV]
var_a = 16 var_b = 5 var_c = var_a * var_b var_d = 8 var_e = var_c / var_d print(int(var_e))
Possibility
If you form a three-digit number using three different numbers among 5, 2, 8 and 0, how many numbers are there that are greater than or equal to 550 and less than or equal to 850?
6
[OP_LIST_SOL] 5 2 8 0 [OP_LIST_EOL] 3 [OP_LIST_GET_PERM] 550 [OP_LIST_MORE] 850 [OP_LIST_LESS] [OP_LIST_LEN]
var_a = 5 var_b = 2 var_c = 8 var_d = 0 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 = 3 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 = 550 list_c = [] for i in list_b: if i > var_f: list_c.append(i) var_g = 850 list_d = [] for i in list_c: if i < var_g: list_d.append(i) var_h = len(list_d) print(int(var_h))
Geometry
If an equilateral triangle is formed using wire that is 8 meters (m) long, how many meters (m) is the length of one side of the triangle?
2.67
8 3 [OP_DIV]
var_a = 8 var_b = 3 var_c = var_a / var_b print('{:.2f}'.format(round(var_c+1e-10,2)))
Arithmetic calculation
Doyoung's school has 1260 students. 7/18 of Doyoung's school students gathered in the auditorium, and 6/11 of the students who was not in the auditorium are in the classroom. How many students are there in the classroom?
420
1260 1 7/18 [OP_SUB] [OP_MUL] 6/11 [OP_MUL]
var_a = 1260 var_b = 1 var_c = 0.3888888888888889 var_d = var_b - var_c var_e = var_a * var_d var_f = 0.5454545454545454 var_g = var_e * var_f print(int(eval('{:.2f}'.format(round(var_g+1e-10,2)))))
Comparison
There are a triangle with a length of a base of 10 centimeters (cm) and a height of 11 centimeters (cm), a square with a side of 8 centimeters (cm), and a circle with a diameter of 8 centimeters (cm). Which figure has the largest area when the pi of a circle is calculated as 3.1?
square
[OP_LIST_SOL] triangle square circle [OP_LIST_EOL] [OP_LIST_SOL] 10 11 [OP_MUL] 2 [OP_DIV] 8 2 [OP_POW] 8 2 [OP_DIV] 2 [OP_POW] 3.1 [OP_MUL] [OP_LIST_EOL] 1 [OP_LIST_MAX] [OP_LIST_INDEX] [OP_LIST_POP] [OP_LIST_GET]
var_a = 'triangle' var_b = 'square' var_c = 'circle' 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 = 10 var_e = 11 var_f = var_d * var_e var_g = 2 var_h = var_f / var_g var_i = 8 var_j = 2 var_k = var_i ** var_j var_l = 8 var_m = 2 var_n = var_l / var_m var_o = 2 var_p = var_n ** var_o var_q = 3.1 var_r = var_p * var_q list_b= [] if "/" in str(var_r): var_r = eval(str(var_r)) list_b.append(var_r) if "/" in str(var_k): var_k = eval(str(var_k)) list_b.append(var_k) if "/" in str(var_h): var_h = eval(str(var_h)) list_b.append(var_h) list_b.reverse() var_s = 1 list_c=list_b.copy() list_c.sort() var_t = list_c[-var_s] var_u = list_b.index(var_t)+1 var_v = list_a[var_u-1] print(var_v)
Geometry
If the surface area of the cube is 864 square centimeters (cm2), find how many centimeters (cm) are the length of one side of the cube.
12
864 6 [OP_DIV] 1/2 [OP_POW]
var_a = 864 var_b = 6 var_c = var_a / var_b var_d = 0.5 var_e = var_c ** var_d print(int(var_e))
Geometry
Marbles of the same size are arranged in a regular arrangement without gaps to form a square with 36 marbles around it. How many marbles are on the outermost of one side?
10
36 4 [OP_DIV] 1 [OP_ADD]
var_a = 36 var_b = 4 var_c = var_a / var_b var_d = 1 var_e = var_c + var_d print(int(var_e))
Arithmetic calculation
You have 32 aluminum bats at home. There are 5 fewer aluminum bats than wooden bats, and 3 more gloves than aluminum bats. How many wooden bats, aluminum bats and gloves do you have at home in total?
104
32 32 5 [OP_ADD] [OP_ADD] 32 3 [OP_ADD] [OP_ADD]
var_a = 32 var_b = 32 var_c = 5 var_d = var_b + var_c var_e = var_a + var_d var_f = 32 var_g = 3 var_h = var_f + var_g var_i = var_e + var_h print(int(var_i))
Correspondence
It is said that dividing 5 and 4/9 by 7 is equal to multiplying the number by 5. Find the number rounding to two decimal places.
0.16
5 4/9 [OP_ADD] 7 [OP_DIV] 5 [OP_DIV]
var_a = 5 var_b = 0.4444444444444444 var_c = var_a + var_b var_d = 7 var_e = var_c / var_d var_f = 5 var_g = var_e / var_f print('{:.2f}'.format(round(var_g+1e-10,2)))
Arithmetic calculation
This year, Yujeong is 12 years old and her mother is 42 years old. In what year was her mother's age 4 times her age?
2
12 4 [OP_MUL] 42 [OP_SUB] 4 1 [OP_SUB] [OP_DIV]
var_a = 12 var_b = 4 var_c = var_a * var_b var_d = 42 var_e = var_c - var_d var_f = 4 var_g = 1 var_h = var_f - var_g var_i = var_e / var_h print(int(var_i))
Arithmetic calculation
Hoseok paid 7 1,000 won bills, 4 100 won coins, and 5 10 won coins while shopping item (a) at the mart. What is the price of the item (a) that Hoseok bought at the mart?
7450
1000 7 [OP_MUL] 100 4 [OP_MUL] [OP_ADD] 10 5 [OP_MUL] [OP_ADD]
var_a = 1000 var_b = 7 var_c = var_a * var_b var_d = 100 var_e = 4 var_f = var_d * var_e var_g = var_c + var_f var_h = 10 var_i = 5 var_j = var_h * var_i var_k = var_g + var_j print(int(var_k))
Correspondence
Dividing 82.04 by a certain number results in 28. What is the value of the certain number?
2.93
1 28 82.04 [OP_DIV] [OP_DIV]
var_a = 1 var_b = 28 var_c = 82.04 var_d = var_b / var_c var_e = var_a / var_d print('{:.2f}'.format(round(var_e+1e-10,2)))
Arithmetic calculation
If the weights of Hanbyul and Hansol are added together, it is 88 kilograms (kg), and if Hanbyul weighs 4 kilograms (kg) more than Hansol, find out how many kilograms (kg) Hansol weighs.
42
88 4 [OP_SUB] 2 [OP_DIV]
var_a = 88 var_b = 4 var_c = var_a - var_b var_d = 2 var_e = var_c / var_d print(int(var_e))
Correspondence
I had to add a number to 36 but I made a mistake and subtracted a number from 63 and it became 70. Find out how much it is if you calculate it correctly.
29
36 63 70 [OP_SUB] [OP_ADD]
var_a = 36 var_b = 63 var_c = 70 var_d = var_b - var_c var_e = var_a + var_d print(int(var_e))
Comparison
When 7 flowers (a), (b), (c), (d), (e), (f), and (g) were planted in order, what is the name of the 5th flower planted?
(e)
[OP_LIST_SOL] (a) (b) (c) (d) (e) (f) (g) [OP_LIST_EOL] 5 [OP_LIST_GET]
var_a = '(a)' var_b = '(b)' var_c = '(c)' var_d = '(d)' var_e = '(e)' var_f = '(f)' var_g = '(g)' list_a= [] if "/" in str(var_g): var_g = eval(str(var_g)) list_a.append(var_g) if "/" in str(var_f): var_f = eval(str(var_f)) list_a.append(var_f) 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_h = 5 var_i = list_a[var_h-1] print(var_i)
Correspondence
The five-digit number A835B is divisible by 12. Find the difference between the largest and the smallest five-digit number if numbers are put in A and B.
69996
A835B [OP_GEN_POSSIBLE_LIST] 12 [OP_LIST_DIVISIBLE] 1 [OP_LIST_MAX] 1 [OP_LIST_MIN] [OP_SUB]
var_a = 'A835B' 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 = 12 list_b = [] var_b = int(var_b) for i in list_a: i = int(i) if i % var_b == 0: list_b.append(i) var_c = 1 list_c=list_b.copy() list_c.sort() var_d = list_c[-var_c] var_e = 1 list_d=list_b.copy() list_d.sort() var_f = list_d[var_e-1] var_g = var_d - var_f print(int(var_g))
Comparison
Seokjin and Taehyung each had 10 pieces of drawing paper. Seokjin used 5 pieces and Taehyung used 4 pieces. Who has more drawing paper left?
Taehyung
[OP_LIST_SOL] Seokjin Taehyung [OP_LIST_EOL] [OP_LIST_SOL] 10 5 [OP_SUB] 10 4 [OP_SUB] [OP_LIST_EOL] 1 [OP_LIST_MAX] [OP_LIST_INDEX] [OP_LIST_POP] [OP_LIST_GET]
var_a = 'Seokjin' var_b = 'Taehyung' list_a= [] 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_c = 10 var_d = 5 var_e = var_c - var_d var_f = 10 var_g = 4 var_h = var_f - var_g list_b= [] if "/" in str(var_h): var_h = eval(str(var_h)) list_b.append(var_h) if "/" in str(var_e): var_e = eval(str(var_e)) list_b.append(var_e) list_b.reverse() var_i = 1 list_c=list_b.copy() list_c.sort() var_j = list_c[-var_i] var_k = list_b.index(var_j)+1 var_l = list_a[var_k-1] print(var_l)
Comparison
The distance from the farm to the house is 396 meters (m), and the distance from the farm to the field is 0.389 kilometers (km). Which is closer to the farm between the house and the field?
field
[OP_LIST_SOL] house field [OP_LIST_EOL] [OP_LIST_SOL] 396 0.389 1000 [OP_MUL] [OP_LIST_EOL] 1 [OP_LIST_MIN] [OP_LIST_INDEX] [OP_LIST_POP] [OP_LIST_GET]
var_a = 'house' var_b = 'field' list_a= [] 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_c = 396 var_d = 0.389 var_e = 1000 var_f = var_d * var_e list_b= [] if "/" in str(var_f): var_f = eval(str(var_f)) list_b.append(var_f) if "/" in str(var_c): var_c = eval(str(var_c)) list_b.append(var_c) list_b.reverse() var_g = 1 list_c=list_b.copy() list_c.sort() var_h = list_c[var_g-1] var_i = list_b.index(var_h)+1 var_j = list_a[var_i-1] print(var_j)
Arithmetic calculation
You are given four numbers: 10, 11, 12, and 13. What is the remainder when the second largest number is divided by the smallest number?
2
[OP_LIST_SOL] 10 11 12 13 [OP_LIST_EOL] 2 [OP_LIST_MAX] 1 [OP_LIST_MIN] [OP_MOD]
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 = 2 list_b=list_a.copy() list_b.sort() var_f = list_b[-var_e] var_g = 1 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))
Geometry
I drew the largest circle that can be drawn on a square-shaped playground. Assuming pi as 3.1, if the area of this field is 400 square meters (m2), what is the area of the circle?
310
3.1 400 1/2 [OP_POW] 2 [OP_DIV] 2 [OP_POW] [OP_MUL]
var_a = 3.1 var_b = 400 var_c = 0.5 var_d = var_b ** var_c var_e = 2 var_f = var_d / var_e var_g = 2 var_h = var_f ** var_g var_i = var_a * var_h print(int(var_i))
Comparison
Horses, Cows, Pigs, Sheep, Rabbits, and Squirrels entered the fence in that order. What's the 4th animal?
Sheep
[OP_LIST_SOL] Horse Cow Pig Sheep Rabbit Squirrel [OP_LIST_EOL] 4 [OP_LIST_GET]
var_a = 'Horse' var_b = 'Cow' var_c = 'Pig' var_d = 'Sheep' var_e = 'Rabbit' var_f = 'Squirrel' list_a= [] if "/" in str(var_f): var_f = eval(str(var_f)) list_a.append(var_f) 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_g = 4 var_h = list_a[var_g-1] print(var_h)
Arithmetic calculation
When Jungkook divided, the quotient was 29 and the remainder was 77. However, this was the result of misreading and calculating by changing the tens and ones digits of the correct divisor 59. Find the sum of the correctly calculated quotient and remainder.
48
95 29 [OP_MUL] 77 [OP_ADD] 59 [OP_FDIV] 95 29 [OP_MUL] 77 [OP_ADD] 59 [OP_MOD] [OP_ADD]
var_a = 95 var_b = 29 var_c = var_a * var_b var_d = 77 var_e = var_c + var_d var_f = 59 var_g = var_e // var_f var_h = 95 var_i = 29 var_j = var_h * var_i var_k = 77 var_l = var_j + var_k var_m = 59 var_n = var_l % var_m var_o = var_g + var_n print(int(var_o))
Geometry
A rectangular bill is 28 centimeters (cm) in perimeter and 6 centimeters (cm) in width. Find the area of this bill.
48
28 2 [OP_DIV] 6 [OP_SUB] 6 [OP_MUL]
var_a = 28 var_b = 2 var_c = var_a / var_b var_d = 6 var_e = var_c - var_d var_f = 6 var_g = var_e * var_f print(int(var_g))
Possibility
I'm trying to make a number with only 3, 9, 5, and 8. If each number can only be used once, what is the sum of largest two-digit number and the remaining two numbers?
106
[OP_LIST_SOL] 3 9 5 8 [OP_LIST_EOL] 2 [OP_LIST_GET_PERM] 1 [OP_LIST_MAX] 1 [OP_LIST_MIN] [OP_NUM2LIST] [OP_LIST_SUM] [OP_ADD]
var_a = 3 var_b = 9 var_c = 5 var_d = 8 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] var_h = 1 list_d=list_b.copy() list_d.sort() var_i = list_d[var_h-1] list_e = [] var_i = int(var_i) while var_i//10 > 0: list_e.append(var_i%10) var_i = var_i//10 list_e.append(var_i%10) list_e = list_e[::-1] list_e = [float(i) for i in list_e] var_j = sum(list_e) var_k = var_g + var_j print(int(var_k))
Possibility
We want to find the difference between the largest three-digit number and the third largest three-digit number using all three number magnets once. Given a magnet with 1, 6, and 8 on it, what is the answer?
180
[OP_LIST_SOL] 1 6 8 [OP_LIST_EOL] [OP_LIST_LEN] [OP_LIST_GET_PERM] 1 [OP_LIST_MAX] 3 [OP_LIST_MAX] [OP_SUB]
var_a = 1 var_b = 6 var_c = 8 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 = len(list_a) 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] var_g = 3 list_d=list_b.copy() list_d.sort() var_h = list_d[-var_g] var_i = var_f - var_h print(int(var_i))
Arithmetic calculation
There are four numbers 10, 11, 12, and 13. What is the remainder when the 3rd smallest number is divided by and the 2nd smallest number?
1
[OP_LIST_SOL] 10 11 12 13 [OP_LIST_EOL] 3 [OP_LIST_MIN] 2 [OP_LIST_MIN] [OP_MOD]
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 = 3 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))
Possibility
You are trying to write natural numbers from 1 to 30. How many times should the number 2 be written in all?
13
1 30 1 [OP_LIST_ARANGE] [OP_LIST2NUM] [OP_NUM2LIST] 2 [OP_LIST_FIND_NUM]
var_a = 1 var_b = 30 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 = 2 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))
Geometry
How many edges are there in a regular octahedron?
12
12
var_a = 12 print(int(var_a))
Possibility
There is a cuboid. Find the number of faces that meet at one vertex of this cuboid.
3
3
var_a = 3 print(int(var_a))
Arithmetic calculation
There are four numbers 10, 11, 12, and 13. What is the quotient of the second largest number divided by the smallest number?
1
[OP_LIST_SOL] 10 11 12 13 [OP_LIST_EOL] 2 [OP_LIST_MAX] 1 [OP_LIST_MIN] [OP_FDIV]
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 = 2 list_b=list_a.copy() list_b.sort() var_f = list_b[-var_e] var_g = 1 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))
Geometry
A 32 centimeters (cm) long string was used to make a rectangle with the same length of all four sides. What is the area of the rectangle you created in square centimeters (cm2)?
64
32 4 [OP_DIV] 2 [OP_POW]
var_a = 32 var_b = 4 var_c = var_a / var_b var_d = 2 var_e = var_c ** var_d print(int(var_e))
Comparison
As a result of multiplying two-digit numbers, Hyeonseong got 1485. However, this is a miscalculation of the number 5 in the tens place as 3. If the correctly calculated value is 2385, write the larger number among the two-digit number.
53
[OP_LIST_SOL] 1485 2385 [OP_SUB] 3 5 [OP_SUB] 10 [OP_MUL] [OP_DIV] 2385 1485 2385 [OP_SUB] 3 5 [OP_SUB] 10 [OP_MUL] [OP_DIV] [OP_DIV] [OP_LIST_EOL] 1 [OP_LIST_MAX]
var_a = 1485 var_b = 2385 var_c = var_a - var_b var_d = 3 var_e = 5 var_f = var_d - var_e var_g = 10 var_h = var_f * var_g var_i = var_c / var_h var_j = 2385 var_k = 1485 var_l = 2385 var_m = var_k - var_l var_n = 3 var_o = 5 var_p = var_n - var_o var_q = 10 var_r = var_p * var_q var_s = var_m / var_r var_t = var_j / var_s list_a= [] if "/" in str(var_t): var_t = eval(str(var_t)) list_a.append(var_t) if "/" in str(var_i): var_i = eval(str(var_i)) list_a.append(var_i) list_a.reverse() var_u = 1 list_b=list_a.copy() list_b.sort() var_v = list_b[-var_u] print(int(var_v))
Arithmetic calculation
How numbers are less than 200, which are also multiples of 15 and 6?
6
1 200 1 [OP_LIST_ARANGE] 6 [OP_LIST_DIVISIBLE] 15 [OP_LIST_DIVISIBLE] 200 [OP_LIST_LESS] [OP_LIST_LEN]
var_a = 1 var_b = 200 var_c = 1 list_a = [i for i in range(var_a, var_b + 1, var_c)] var_d = 6 list_b = [] var_d = int(var_d) for i in list_a: i = int(i) if i % var_d == 0: list_b.append(i) var_e = 15 list_c = [] var_e = int(var_e) for i in list_b: i = int(i) if i % var_e == 0: list_c.append(i) var_f = 200 list_d = [] for i in list_c: if i < var_f: list_d.append(i) var_g = len(list_d) print(int(var_g))
Arithmetic calculation
You want to set up street lights at intervals of 4 meters (m) on both sides of a road that is 260 meters (m) long. If you put up street lights at the beginning and at the end as well, find out how many street lights are needed.
132
260 4 [OP_DIV] 1 [OP_ADD] 2 [OP_MUL]
var_a = 260 var_b = 4 var_c = var_a / var_b var_d = 1 var_e = var_c + var_d var_f = 2 var_g = var_e * var_f print(int(var_g))
Correspondence
The four-digit number A12B is a multiple of 8 and when divided by 3, the remainder is 1. Find the sum of the possible B's.
8
A12B [OP_GEN_POSSIBLE_LIST] 8 [OP_LIST_DIVISIBLE] 3 1 [OP_LIST_DIVIDE_AND_REMAIN] A12B B [OP_LIST_FIND_UNK] [OP_LIST_SUM]
var_a = 'A12B' 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 = 8 list_b = [] var_b = int(var_b) for i in list_a: i = int(i) if i % var_b == 0: list_b.append(i) var_c = 3 var_d = 1 list_c = [] var_c = int(var_c) var_d = int(var_d) if var_d < 0: var_d = var_d + var_c for i in list_b: i = int(i) if i%var_c == var_d: list_c.append(i) var_e = 'A12B' var_f = 'B' var_e = str(var_e) var_f = str(var_f) unk_idx = var_e.index(var_f) list_d = [] for elem in list_c: elem = str(elem) list_d.append(int(elem[unk_idx])) list_d = list(set(list_d)) list_d = [float(i) for i in list_d] var_g = sum(list_d) print(int(var_g))
Geometry
Suzy has 3.2 sheets of square paper with sides measuring 8.5 meters (m). How big could this area get by gluing these papers in a row?
231.2
8.5 2 [OP_POW] 3.2 [OP_MUL]
var_a = 8.5 var_b = 2 var_c = var_a ** var_b var_d = 3.2 var_e = var_c * var_d print('{:.2f}'.format(round(var_e+1e-10,2)))
Arithmetic calculation
Hyungjun's number is 010-3380-2798. How many times do you have to press 3 to call Hyeongjun?
2
[OP_LIST_SOL] 0 1 0 3 3 8 0 2 7 9 8 [OP_LIST_EOL] 3 [OP_LIST_FIND_NUM]
var_a = 0 var_b = 1 var_c = 0 var_d = 3 var_e = 3 var_f = 8 var_g = 0 var_h = 2 var_i = 7 var_j = 9 var_k = 8 list_a= [] if "/" in str(var_k): var_k = eval(str(var_k)) list_a.append(var_k) if "/" in str(var_j): var_j = eval(str(var_j)) list_a.append(var_j) if "/" in str(var_i): var_i = eval(str(var_i)) list_a.append(var_i) if "/" in str(var_h): var_h = eval(str(var_h)) list_a.append(var_h) if "/" in str(var_g): var_g = eval(str(var_g)) list_a.append(var_g) if "/" in str(var_f): var_f = eval(str(var_f)) list_a.append(var_f) 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_l = 3 var_m = 0 var_l = int(var_l) for i in list_a: i = int(i) if i == var_l: var_m = var_m + 1 print(int(var_m))
Arithmetic calculation
There are four numbers 10, 11, 12, and 13. What do you get for the second largest number minus the smallest number?
2
[OP_LIST_SOL] 10 11 12 13 [OP_LIST_EOL] 2 [OP_LIST_MAX] 1 [OP_LIST_MIN] [OP_SUB]
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 = 2 list_b=list_a.copy() list_b.sort() var_f = list_b[-var_e] var_g = 1 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))
Arithmetic calculation
The water supply was turned on at a rate of 200 kilograms (kg) per hour in a water tank that can contain 4,000 kilograms (kg) of water. If you left the water running on this empty water tank for one day, find how many kilograms (kg) of water overflowed.
800
200 24 [OP_MUL] 4000 [OP_SUB] [OP_ABS]
var_a = 200 var_b = 24 var_c = var_a * var_b var_d = 4000 var_e = var_c - var_d var_f = abs(var_e) print(int(var_f))
Comparison
When a string measuring 3 meters (m) and 48 centimeters (cm) in length was cut into two parts, the difference between the lengths of the two parts was 72 centimeters (cm). Find the length of the longer string in centimeters (cm).
210
3 100 [OP_MUL] 48 [OP_ADD] 72 [OP_SUB] 2 [OP_DIV] 72 [OP_ADD]
var_a = 3 var_b = 100 var_c = var_a * var_b var_d = 48 var_e = var_c + var_d var_f = 72 var_g = var_e - var_f var_h = 2 var_i = var_g / var_h var_j = 72 var_k = var_i + var_j print(int(var_k))
Arithmetic calculation
There are currently 63 people on the train. 78 people were on the train when it first departed, and 27 people got off after that. How many extra people got on the train?
12
63 27 [OP_ADD] 78 [OP_SUB]
var_a = 63 var_b = 27 var_c = var_a + var_b var_d = 78 var_e = var_c - var_d print(int(var_e))
Possibility
Hayeon has magnets written 0, 1 and 2 respectively. How many two-digit natural numbers can she make using that number magnets?
4
[OP_LIST_SOL] 0 1 2 [OP_LIST_EOL] 2 [OP_LIST_GET_PERM] [OP_LIST_LEN]
var_a = 0 var_b = 1 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 = 2 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 = len(list_b) print(int(var_e))
Comparison
There are five numbers 1/10, 8, 0.9, 7/10, and 5. How many of these numbers are less than 1?
3
[OP_LIST_SOL] 1/10 8 0.9 7/10 5 [OP_LIST_EOL] 1 [OP_LIST_LESS] [OP_LIST_LEN]
var_a = 0.1 var_b = 8 var_c = 0.9 var_d = 0.7 var_e = 5 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 list_b = [] for i in list_a: if i < var_f: list_b.append(i) var_g = len(list_b) print(int(var_g))
Geometry
If the length of the lower side is 6 centimeters (cm) longer than the length of the upper side and the area of the trapezoid is 8 centimeters (cm) and the area is 72 square cm (cm2), find the length of the upper side of the trapezoid.
6
72 2 [OP_MUL] 8 [OP_DIV] 6 [OP_SUB] 2 [OP_DIV]
var_a = 72 var_b = 2 var_c = var_a * var_b var_d = 8 var_e = var_c / var_d var_f = 6 var_g = var_e - var_f var_h = 2 var_i = var_g / var_h print(int(var_i))
Comparison
Yoongi collected 4 and Yuna collected 5. If Jungkook collected the sum of 6 and 3, who has the smallest number?
Yoongi
[OP_LIST_SOL] Yoongi Yuna Jungkook [OP_LIST_EOL] [OP_LIST_SOL] 4 5 6 3 [OP_ADD] [OP_LIST_EOL] 1 [OP_LIST_MIN] [OP_LIST_INDEX] [OP_LIST_POP] [OP_LIST_GET]
var_a = 'Yoongi' var_b = 'Yuna' var_c = 'Jungkook' 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 = 4 var_e = 5 var_f = 6 var_g = 3 var_h = var_f + var_g list_b= [] if "/" in str(var_h): var_h = eval(str(var_h)) list_b.append(var_h) if "/" in str(var_e): var_e = eval(str(var_e)) list_b.append(var_e) if "/" in str(var_d): var_d = eval(str(var_d)) list_b.append(var_d) list_b.reverse() var_i = 1 list_c=list_b.copy() list_c.sort() var_j = list_c[var_i-1] var_k = list_b.index(var_j)+1 var_l = list_a[var_k-1] print(var_l)
Possibility
Find how many are there to divide cookies when you try to put 10 cookies in 2 different boxes. (There should be at least one cookie in the box.)
9
10 2 [OP_SUB] 1 [OP_ADD]
var_a = 10 var_b = 2 var_c = var_a - var_b var_d = 1 var_e = var_c + var_d print(int(var_e))
Comparison
The weight of the clay used by Chanwoo to make pottery is 0.645 kilograms (kg), and the weight of the clay used by Yerim is 0.65 kilograms (kg). Who used more clay?
Yerim
[OP_LIST_SOL] Yerim Chanwoo [OP_LIST_EOL] [OP_LIST_SOL] 0.65 0.645 [OP_LIST_EOL] 1 [OP_LIST_MAX] [OP_LIST_INDEX] [OP_LIST_POP] [OP_LIST_GET]
var_a = 'Yerim' var_b = 'Chanwoo' list_a= [] 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_c = 0.65 var_d = 0.645 list_b= [] if "/" in str(var_d): var_d = eval(str(var_d)) list_b.append(var_d) if "/" in str(var_c): var_c = eval(str(var_c)) list_b.append(var_c) list_b.reverse() var_e = 1 list_c=list_b.copy() list_c.sort() var_f = list_c[-var_e] var_g = list_b.index(var_f)+1 var_h = list_a[var_g-1] print(var_h)
Geometry
How many times is the volume of a cube with a width, length, and height of 2 meters (m) bigger compared to the volume of a cube with width, length, and height of 100 centimeters (cm)?
8
2 3 [OP_POW] 100 100 [OP_DIV] 3 [OP_POW] [OP_DIV]
var_a = 2 var_b = 3 var_c = var_a ** var_b var_d = 100 var_e = 100 var_f = var_d / var_e var_g = 3 var_h = var_f ** var_g var_i = var_c / var_h print(int(var_i))
Arithmetic calculation
There are 8 same candies in basket (A) and 17 in basket (B). How many candies should you put in basket (A) to make the number of candies in both baskets equal?
9
17 8 [OP_SUB]
var_a = 17 var_b = 8 var_c = var_a - var_b print(int(var_c))
Arithmetic calculation
If you subtract Jimin's weight from Taehyung's weight, it is 4 kilograms (kg). If the sum of Taehyung's and Jimin's weights is 88 kilograms (kg), how many kilograms (kg) does Jimin weigh?
42
88 4 [OP_SUB] 2 [OP_DIV]
var_a = 88 var_b = 4 var_c = var_a - var_b var_d = 2 var_e = var_c / var_d print(int(var_e))
Arithmetic calculation
Minyoung has a 17 meters (m) and 48 centimeters (cm) of tape, and Yoojung has an 850 centimeters (cm) of tape. Find how much Minyoung should give Yoojung a tape in centimeters (cm), so that both of them have the same length of tape.
449
17 100 [OP_MUL] 48 [OP_ADD] 850 [OP_SUB] 2 [OP_DIV]
var_a = 17 var_b = 100 var_c = var_a * var_b var_d = 48 var_e = var_c + var_d var_f = 850 var_g = var_e - var_f var_h = 2 var_i = var_g / var_h print(int(var_i))
Possibility
You want to create a three-digit number by drawing three out of 1, 7, 0, and 3 and using them only once. Find the difference between the second largest number and the second smallest number that can be made.
623
[OP_LIST_SOL] 1 7 0 3 [OP_LIST_EOL] 3 [OP_LIST_GET_PERM] 2 [OP_LIST_MAX] 2 [OP_LIST_MIN] [OP_SUB] [OP_ABS]
var_a = 1 var_b = 7 var_c = 0 var_d = 3 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 = 3 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 = 2 list_c=list_b.copy() list_c.sort() var_g = list_c[-var_f] var_h = 2 list_d=list_b.copy() list_d.sort() var_i = list_d[var_h-1] var_j = var_g - var_i var_k = abs(var_j) print(int(var_k))
Arithmetic calculation
One children's book is 161 pages. If Jimin read this children's book for a week, find the average number of pages she read per day.
23
161 7 [OP_DIV]
var_a = 161 var_b = 7 var_c = var_a / var_b print(int(var_c))
Correspondence
Cheulsu made a mistake in dividing a number by 18, so he divided the number by 1.8, and the quotient was 21, and the remainder was 0.2. Round the correct quotient to two decimal places.
2.11
21 1.8 [OP_MUL] 0.2 [OP_ADD] 18 [OP_DIV] 2 [OP_ROUND]
var_a = 21 var_b = 1.8 var_c = var_a * var_b var_d = 0.2 var_e = var_c + var_d var_f = 18 var_g = var_e / var_f var_h = 2 var_i = round(float(var_g)+1e-10, var_h) print('{:.2f}'.format(round(var_i+1e-10,2)))
Correspondence
Say that the equation A5+2B=68 is correct. What number can go into A, where A is a single-digit number?
4
A5+2B=68 A [OP_DIGIT_UNK_SOLVER]
var_a = 'A5+2B=68' var_b = 'A' 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))