Finish 2010-11-17 12:00:00 UTC

1 way

by Amitabh Verma

Status: Passed
Results: 521637 (cyc: 1, node: 97)
CPU Time: 0.067
Score: 104328.0
Submitted at: 2010-11-16 07:29:33 UTC
Scored at: 2010-11-16 07:30:14 UTC

Current Rank: 3017th (Highest: 1974th )
Based on: thinking (diff)
Basis for: 1 way (diff)

Comments
Please login or create a profile.
Code
function [tr, tc] = solver(chart, ai, bi, mt)

[ar, ac] = ind2sub(size(chart(:,:,1)),ai);
[br, bc] = ind2sub(size(chart(:,:,1)),bi);

dr=round((ar+br)/1.94)-ar;
dc=round((ac+bc)/1.94)-ac;

foo=0.996/(abs(dr)+abs(dc))*mt;


tr=round(dr*foo);
tc=round(dc*foo);

end