Regarding the current events in Ukraine:
CEASE*FIRE=AUDIENCE
Solving the above, decode 03952 and comment how the result describes the status.
clearvars,clc
tic
numSets=perms('0123456789');
lets='ceasfirudn';
w1='cease';
w2='fire';
w3='audience';
for i=1:length(numSets)
w1n=w1;
for j=1:10
w1n=strrep(w1n,lets(j),numSets(i,j));
end
w2n=w2;
for j=1:10
w2n=strrep(w2n,lets(j),numSets(i,j));
end
w3n=w3;
for j=1:10
w3n=strrep(w3n,lets(j),numSets(i,j));
end
if str2double(w1n)*str2double(w2n)==str2double(w3n)
disp([w1n ' ' w2n ' ' w3n])
end
end
toc
finds
16906 5486 92746316 for
cease fire audience
03952 then translates to
snafu
Elapsed time is 312.913938 seconds.
I tried to speed up run time by doing only one translation to numeric instead of three, and then evaluating with the eval( function.
clearvars,clc
tic
numSets=perms('0123456789');
lets='ceasfirudn';
w1='cease*fire==audience';
for i=1:length(numSets)
w1n=w1;
for j=1:10
w1n=strrep(w1n,lets(j),numSets(i,j));
end
cease=w1n(1:5);
fire=w1n(7:10);
audience=w1n(13:end);
if eval(w1n)
disp(w1n)
end
end
toc
But I got
16906*5486==92746316
Elapsed time is 631.021847 seconds.
Just over 10 minutes instead of 5.
|
Posted by Charlie
on 2023-05-31 10:01:45 |