在Ruby 1.87我可以这样做:
Date.parse ("3/21/2011")
Run Code Online (Sandbox Code Playgroud)
现在在1.9.2我得到:
ArgumentError:无效的日期
有任何想法吗?
我在java中将这个解决方案写入Project Euler#215.它不需要在不到一分钟的时间内完成W(32,10)的计算.我希望能得到一些关于如何加快速度的建议.我想知道添加线程是否合适,或者是否有方法来缓存buildWall()方法中每行的结果.
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.HashMap;
import java.util.Map;
class BlockCombos
{
static ArrayList<String> possibleRows = new ArrayList<String>();
static long validWalls = 0;
static Map<Integer, List> map = new HashMap<Integer, List>();
static int[][] cache;
public static void main(String[] args)
{
if (args.length != 2)
{
System.out.println("Error: You need to enter a height and width.");
}
else
{
int height = Integer.parseInt(args[1]);
int width = Integer.parseInt(args[0]);
//numbers proportionate to block widths
//reduced for less …Run Code Online (Sandbox Code Playgroud)