| 赞 | 66 |
| VIP | |
| 好人卡 | |
| 积分 | 19 |
| 经验 | |
| 最后登录 | 2026-7-23 |
| 在线时间 | 1555 小时 |
- 梦石
- 0
- 星屑
- 1907
- 在线时间
- 1555 小时
- 注册时间
- 2013-4-13
- 回帖
- 783
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
本帖最后由 沉滞的剑 于 2013-4-18 15:49 编辑
- def switch(a,x,y)
- a.insert(y+1,a[x])
- a.delete_at(x)
- end
- def sortpos
- x=0
- y=1
- while x < @breadth.size - 1
- while y < @breadth.size
- if @breadth[y-1] > @breadth[y]
- switch(@depth,y-1,y)
- switch(@breadth,y-1,y)
- switch(@perks,y-1,y)
- elsif @breadth[y-1] == @breadth[y] && @depth[y-1] > @depth[y]
- switch(@depth,y-1,y)
- switch(@breadth,y-1,y)
- switch(@perks,y-1,y)
- end
- p @breadth
- p @depth
- p @perks
- p x.to_s + ","+ y.to_s
- y = y + 1
- end
- x = x + 1
- y = 1
-
- end
- end
复制代码
-----------------------------------------------------------
我2B了,查错数了 改成小于号判断就好了 总共就6位
数学渣渣给各位道歉了....
|
|