JAVA代码在此,运行可得....
<%
examples = %w[
8809=6
7111=0
2172=0
6666=4
1111=0
3213=0
7662=2
9313=1
0000=4
2222=0
3333=0
5555=0
8193=3
8096=5
1012=1
7777=0
9999=4
7756=1
6855=3
9881=5
5531=0
]
%>
import java.util.Arrays;
class baka {
public static void main(String[] args) {
int[] table = new int[10];
<%
10.times do |i|
%>
table[<%= i %>] = 10;
while (table[<%= i %>]-- > 0) {
<%
end
%>
if (
<%=
examples.map do |example|
left, right = example.split("=")
left.scan(/\d/).map{|x| "table[#{x}]" }.join(" + ") + " == #{right}"
end.join(" &&\n")
%>
) {
System.out.println(Arrays.toString(table));
return;
}
<%
10.times do |i|
%>
}
<%
end
%>
}
}