public class T {
public static void main(String[] args) {
int numberOfBalls=34;
String round = String.valueOf(Math.round(numberOfBalls / 6));
String mod=String.valueOf(numberOfBalls%6);
double numberOfOvers=Double.valueOf(round+"."+mod);
System.out.println(numberOfOvers);
}
}
$ball__= 15;
$over=0;
if($ball__>=6 && $ball__<12){
$over+=1;
if($ball__==6){$ball__=0;}
if($ball__==7){$ball__=1;}
if($ball__==8){$ball__=2;}
if($ball__==9){$ball__=3;}
if($ball__==10){$ball__=4;}
if($ball__==11){$ball__=5;}
}
if($ball__>=12 && $ball__<18){
$over+=2;
if($ball__==12){$ball__=0;}
if($ball__==13){$ball__=1;}
if($ball__==14){$ball__=2;}
if($ball__==15){$ball__=3;}
if($ball__==16){$ball__=4;}
if($ball__==17){$ball__=5;}
}
if($ball__>=18 && $ball__<24){
$over+=3;
if($ball__==18){$ball__=0;}
if($ball__==19){$ball__=1;}
if($ball__==20){$ball__=2;}
if($ball__==21){$ball__=3;}
if($ball__==22){$ball__=4;}
if($ball__==23){$ball__=5;}
}
if($ball__>=24 && $ball__<30){
$over+=4;
if($ball__==24){$ball__=0;}
if($ball__==25){$ball__=1;}
if($ball__==26){$ball__=2;}
if($ball__==27){$ball__=3;}
if($ball__==28){$ball__=4;}
if($ball__==29){$ball__=5;}
}
if($ball__>=30 && $ball__<36){
$over+=5;
if($ball__==30){$ball__=0;}
if($ball__==31){$ball__=1;}
if($ball__==32){$ball__=2;}
if($ball__==33){$ball__=3;}
if($ball__==34){$ball__=4;}
if($ball__==35){$ball__=5;}
}
//----and so on up to the number of balls you have to convert into overs. I have done this up to 6 overs(36 balls).
echo ($over.".".$ball__); to show results
7条答案
按热度按时间lf5gs5x21#
luaexgnf2#
eivnm1vs3#
这将帮助您:
ojsjcaue4#
为了从总球交付
如果总球交付是80球然后首先我们必须使它被6整除然后我们得到78从($balls -= $balls % 6;)然后我们除以6,然后我们得到13,意味着13,然后我们必须计算80个球的模,然后这个表达式是使用$f =$balls2% 6;对于模块,然后我得到了2,然后我将值13和2与十进制分隔符= 13.2(overs)((float)$total_overs.'.'.$f;)可以在ex-> 43,44,94,110上测试
jckbn6z75#
简单的公式来计算球的数量从过投球
示例:超出= 96.2
结果:球= 578
9jyewag06#
这是克服这个问题的简单PHP条件。该方法很长,但工作:
”
iih3973s7#
主程序包