how can i get [5, 7, 13, 2] to go to [5*0, 7*1, 13*2, 2*3] then get the sum of this array.
2014-06-23 12:17
656 查看
[5,7,13,2].map.with_index(&:*).inject(:+)
相关文章推荐
- [jQuery] 如何根据名字来选取checkbox数组 -- How to get the array of checkbox via name
- How to get the length of array of strings in C? - Yahoo! Answers
- How can selenium web driver get to know when the new window has opened and then resume its execution
- How To get the Real length of a string with chinese words
- How can I get the IPv4 address of an interface in linux from C code ?
- Can I get rid of the "This page contains both secure and nonsecure items" warning?
- How to get the content of the 'identity' section in web.config
- How to get a notification from Linux when the set of network interfaces changes
- Oracle table fragmentation how to calculate or get the actual used blocks of the table
- Question 33: How can a C++ developer use the placement new syntax to make new allocate an object of class SomeClass at a particu
- “The execution of scripts is disabled on this system” … How to run your own PowerShell scripts
- How can I set the background of UITableView (the tableview style is "Grouped") to use an image?
- How to get the DOM of a WebBrowser control from a window handle (VB6)
- How to get the value of one specified item
- how to get the Authorization of adobe acrobat 8.0 for free
- how to get the space size of some tables in one database?
- CodeSnip: How to Get Id of the Record Using ASP.NET and SQL Server 2000
- I was eager to get my paddles wet and see how this kayak performed in the water.
- How to get the published properties of an persistent object
- how to accepte the array of the checkbox in asp and in php