-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgpt3_solution.py
More file actions
30 lines (27 loc) · 1.22 KB
/
Copy pathgpt3_solution.py
File metadata and controls
30 lines (27 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import json
import time
# START - CODE GENERATED BY gpt3
def solution():
numerator_product = 1
denominator_product = 1
for numerator in range(10, 100):
for denominator in range(numerator+1, 100):
if numerator % 10 == 0 and denominator % 10 == 0:
continue
if numerator // 10 == denominator % 10 and numerator / denominator == (numerator % 10) / (denominator // 10):
numerator_product *= numerator
denominator_product *= denominator
elif numerator % 10 == denominator // 10 and numerator / denominator == (numerator // 10) / (denominator % 10):
numerator_product *= numerator
denominator_product *= denominator
for i in range(2, denominator_product+1):
while numerator_product % i == 0 and denominator_product % i == 0:
numerator_product //= i
denominator_product //= i
return denominator_product
# END - CODE GENERATED BY gpt3
cpu_s, wall_s = time.process_time(), time.time()
result = solution()
cpu_e, wall_e = time.process_time(), time.time()
cpu_time, wall_time = cpu_e - cpu_s, wall_e - wall_s
print(json.dumps({"solution": result, "cpu": cpu_time, "wall": wall_time}))