當前位置:編程學習大全網 - 編程軟體 - 用matlab編程,謝謝大神

用matlab編程,謝謝大神

function?output?=?Untitled(input)

num?=?num_crop(input);

if?num(1,1)^3?+?num(1,2)^3?+?num(1,3)^3?==?input

output?=?floor(input/10)?+?num(1,3)*100;

else

temp?=?(sum(num)+21)?*?10;

num?=?num_crop(temp);

%?exchange

num(1,1)?=?num(1,1)?+?num(1,2);

num(1,2)?=?num(1,1)?-?num(1,2);

num(1,1)?=?num(1,1)?-?num(1,2);

%?step2

temp?=?num_crop(num(1,3)*9);

num(1,3)?=?temp(1,2);

output?=?num(1,1)*100?+?num(1,2)*10?+?num(1,3);

end

end

function?num?=?num_crop(input)

temp?=?floor(input/10);

num(1,3)?=?input?-?temp?*?10;

temp?=?floor(temp/10);

num(1,2)?=?floor(input/10)?-?temp?*?10;

temp?=?floor(temp/10);

num(1,1)?=?floor(input/100)?-?temp?*?10;

end

  • 上一篇:臨沂編程培訓機構排行榜
  • 下一篇:在校大學生可以考的證書有哪些
  • copyright 2024編程學習大全網