Re: [問題] 1-9位數不重複印出來 (ArnoldC)
阿諾語言版 (阿諾語言請參閱 https://github.com/lhartikk/ArnoldC)
程式碼放在 https://gist.github.com/ronnywang/d1a1916f7292f7603a5a6722602443c4
要變更 n 的話可以改第 136 行的 changeMe 變數
會寫這麼長主要是因為阿諾語不支援 array 和 for
所以我必需要用 function 和 while 來模擬 for, array
關於這程式的邏輯我有補充在 gist comment
LISTEN TO ME VERY CAREFULLY check
I NEED YOUR CLOTHES YOUR BOOTS AND YOUR MOTORCYCLE arg1
I NEED YOUR CLOTHES YOUR BOOTS AND YOUR MOTORCYCLE arg2
GIVE THESE PEOPLE AIR
HEY CHRISTMAS TREE varFalse
YOU SET US UP @I LIED
HEY CHRISTMAS TREE varTrue
YOU SET US UP @NO PROBLEMO
HEY CHRISTMAS TREE arg1IsZero
YOU SET US UP varTrue
HEY CHRISTMAS TREE arg1Mod10
YOU SET US UP 0
HEY CHRISTMAS TREE arg1Mod10IsArg2
YOU SET US UP 0
HEY CHRISTMAS TREE newArg1
YOU SET US UP 0
HEY CHRISTMAS TREE result1
YOU SET US UP 0
GET TO THE CHOPPER arg1IsZero
HERE IS MY INVITATION arg1
YOU ARE NOT YOU YOU ARE ME 0
ENOUGH TALK
BECAUSE I'M GOING TO SAY PLEASE arg1IsZero
I'LL BE BACK varTrue
YOU HAVE NO RESPECT FOR LOGIC
GET TO THE CHOPPER arg1Mod10
HERE IS MY INVITATION arg1
I LET HIM GO 10
ENOUGH TALK
GET TO THE CHOPPER arg1Mod10IsArg2
HERE IS MY INVITATION arg1Mod10
YOU ARE NOT YOU YOU ARE ME arg2
ENOUGH TALK
BECAUSE I'M GOING TO SAY PLEASE arg1Mod10IsArg2
I'LL BE BACK varFalse
YOU HAVE NO RESPECT FOR LOGIC
GET TO THE CHOPPER newArg1
HERE IS MY INVITATION arg1
HE HAD TO SPLIT 10
ENOUGH TALK
GET YOUR ASS TO MARS result1
DO IT NOW check newArg1 arg2
I'LL BE BACK result1
HASTA LA VISTA, BABY
LISTEN TO ME VERY CAREFULLY getdigit
I NEED YOUR CLOTHES YOUR BOOTS AND YOUR MOTORCYCLE digit
I NEED YOUR CLOTHES YOUR BOOTS AND YOUR MOTORCYCLE current
I NEED YOUR CLOTHES YOUR BOOTS AND YOUR MOTORCYCLE pos
GIVE THESE PEOPLE AIR
HEY CHRISTMAS TREE n
YOU SET US UP 0
HEY CHRISTMAS TREE d
YOU SET US UP 0
HEY CHRISTMAS TREE isLessThan10
YOU SET US UP @NO PROBLEMO
HEY CHRISTMAS TREE isOver
YOU SET US UP 0
HEY CHRISTMAS TREE dIsNotZero
YOU SET US UP 0
HEY CHRISTMAS TREE nextVar
YOU SET US UP 0
HEY CHRISTMAS TREE nextPos
YOU SET US UP 0
STICK AROUND isLessThan10
GET YOUR ASS TO MARS d
DO IT NOW check current n
GET TO THE CHOPPER dIsNotZero
HERE IS MY INVITATION d
LET OFF SOME STEAM BENNET 0
ENOUGH TALK
BECAUSE I'M GOING TO SAY PLEASE dIsNotZero
GET TO THE CHOPPER isOver
HERE IS MY INVITATION pos
GET UP 1
YOU ARE NOT YOU YOU ARE ME digit
ENOUGH TALK
GET TO THE CHOPPER nextVar
HERE IS MY INVITATION current
YOU'RE FIRED 10
GET UP n
ENOUGH TALK
GET TO THE CHOPPER nextPos
HERE IS MY INVITATION pos
GET UP 1
ENOUGH TALK
BECAUSE I'M GOING TO SAY PLEASE isOver
TALK TO THE HAND nextVar
BULLSHIT
DO IT NOW getdigit digit nextVar nextPos
YOU HAVE NO RESPECT FOR LOGIC
YOU HAVE NO RESPECT FOR LOGIC
GET TO THE CHOPPER n
HERE IS MY INVITATION n
GET UP 1
ENOUGH TALK
GET TO THE CHOPPER isLessThan10
HERE IS MY INVITATION 10
LET OFF SOME STEAM BENNET n
ENOUGH TALK
CHILL
HASTA LA VISTA, BABY
IT'S SHOWTIME
HEY CHRISTMAS TREE changeMe
YOU SET US UP 3
DO IT NOW getdigit changeMe 0 0
YOU HAVE BEEN TERMINATED
--
2
2X
f(X) = ----- f(X) 的圖形... ╯╰ ... 真無奈
2 ∩
X - 1
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 52.69.115.145
※ 文章網址: https://www.ptt.cc/bbs/Programming/M.1481625942.A.6E4.html
※ 編輯: ronnywang (52.69.115.145), 12/13/2016 18:47:20
※ 編輯: ronnywang (52.69.115.145), 12/13/2016 18:52:27
推
12/14 08:28, , 1F
12/14 08:28, 1F
推
12/14 12:10, , 2F
12/14 12:10, 2F
→
12/15 13:18, , 3F
12/15 13:18, 3F
Programming 近期熱門文章
PTT數位生活區 即時熱門文章