MATL , 32 바이트
/YQv'%i/%i+'wYD3L)61yUYQVwV47b&h
온라인으로 사용해보십시오!
설명
고려 [1, 2, 3, 3, 6]
, [2, 9, 3, 2, 4]
입력으로.
/ % Implicit inout. Divide element-wise
% STACK: [0.5 0.222 1 1.5 1.5]
YQ % Rational approximation (with default tolerance)
% STACK: [1 2 1 3 3], [2 9 1 2 2]
v % Conctenate all stack elements vertically
% STACK: [1 2; 2 9; 1 2; 3 2; 3 2]
'%i/%i+' % Push this string (sprintf format specifier)
% STACK: [1 2; 2 9; 1 2; 3 2; 3 2], '%i/%i+'
wYD % Swap, sprintf
% STACK: '1/2+2/9+1/1+3/2+3/2+'
3L) % Remove last entry
% STACK: '1/2+2/9+1/1+3/2+3/2'
61 % Push 61 (ASCII for '=')
% STACK: '1/2+2/9+1/1+3/2+3/2', 61
y % Duplicate from below
% STACK: '1/2+2/9+1/1+3/2+3/2', 61, '1/2+2/9+1/1+3/2+3/2'
U % Evaluste string into a number
% STACK: '1/2+2/9+1/1+3/2+3/2', 61, 4.722
YQ % Rational approximation
% STACK: '1/2+2/9+1/1+3/2+3/2', 61, 85, 18
VwV % Convert to string, swap, convert to string
% STACK: '1/2+2/9+1/1+3/2+3/2', 61, '18', '85'
47 % Push 47 (ASCII for '/')
% STACK: '1/2+2/9+1/1+3/2+3/2', 61, '18', '85', 47
b % Bubble up in stack
% STACK: '1/2+2/9+1/1+3/2+3/2', 61, '85', 47, '18'
&h % Concatenate all stack elements horizontally. Implicitly display
% STACK: '1/2+2/9+1/1+3/2+3/2=85/18'