关于足彩胜负彩的程序:14场结果: 1-3-3-0-3-0-1-1-3-3-3-1-0-3一个单式方案是:
a.txt3 1 3 0 3 0 1 3 3 3 1 1 0 3
1 0 3 0 3 0 1 1 3 3 3 1 0 3
1 3 3 0 3 0 3 1 3 3 3 1 0 3
1 0 3 0 3 0 3 1 3 3 3 3 0 3
1 3 3 0 3 0 1 3 3 3 3 1 0 3
3 1 3 0 3 0 3 1 3 3 3 1 0 3
3 3 3 0 3 0 3 1 3 1 3 3 0 3
0 1 1 0 3 0 3 1 3 3 3 1 0 3
1 3 3 3 3 0 3 1 3 3 3 1 0 3
1 3 1 3 3 0 3 1 3 3 3 1 0 3
求代码,实现:中14场有几注?
中13场有几注?
中12场有几注?
a.txt3 1 3 0 3 0 1 3 3 3 1 1 0 3
1 0 3 0 3 0 1 1 3 3 3 1 0 3
1 3 3 0 3 0 3 1 3 3 3 1 0 3
1 0 3 0 3 0 3 1 3 3 3 3 0 3
1 3 3 0 3 0 1 3 3 3 3 1 0 3
3 1 3 0 3 0 3 1 3 3 3 1 0 3
3 3 3 0 3 0 3 1 3 1 3 3 0 3
0 1 1 0 3 0 3 1 3 3 3 1 0 3
1 3 3 3 3 0 3 1 3 3 3 1 0 3
1 3 1 3 3 0 3 1 3 3 3 1 0 3
求代码,实现:中14场有几注?
中13场有几注?
中12场有几注?
{
int []sum= new int[15];
String s1="1-3-3-0-3-0-1-1-3-3-3-1-0-3";
String []ss1 = s1.split("-");
//begin---以下做一行分析,
String s2 = "3 1 3 0 3 0 1 3 3 3 1 1 0 3";
String []ss2 = s2.split(" ");
int n = 0;
for(int i=0;i<14;++i){
if(ss1[i].equals(ss2[i])) n++;
}
sum[n]++;
//end
//sum[i]中不包含sum[i+1]及更多场次,如对12场的不包含对13/14场的。
for(int i=1; i<=14;++i){
System.out.println("对"+i+"场的共有:"+sum[i]+"注");
}
}随便写写,你把上面begin-end段改为从文件里循环读取一行就行了