for(int i1=0;i1<=10;i++)
{
for(int i2=0;i2<=10;i2++)
{
for(int i3=0;i3<=10;i3++)
{
---
for(int i10=0;i10<=10;i10++)
{
if(i1+i2+i3+……+i10=90)
{
//一种可能
}
}
---
}
}
}
using System;
namespace Test
{
/// <summary>
/// ShotScore 的摘要说明。
/// </summary>
public class ShotScore
{
//总共有多少种可能性
int SumRate = 0;
//每次可能命中的几率范围
int[] ScoreArray;
//总共需要多少分
int totalScore=0;
//一共能打多少次
int totalShot=0;
//当前共打中环数
public ShotScore(int[] sa,int ts,int t)
{
this.ScoreArray = sa;
this.totalShot = ts;
this.totalScore = t;
}
public int GetSum()
{
return SumRate;
}
public void Compute(int currentShot,int cNum)
{
//打多打少都不行
if(currentShot<0||currentShot>totalShot)
{
return;
}
//以后枪枪都中10都不能满足条件,game over
if(((totalShot-currentShot+1)*10)<(totalScore-cNum))
{
return;
}
//打够次数了并且总共达到了预期环数
if(currentShot==totalShot)
{
//这种可能性成立
SumRate++;
return;
}
for(int i=0;i<ScoreArray.Length;i++)
{
Compute(currentShot+1,cNum+ScoreArray[i]);
}
}
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有