110,566
社区成员
发帖
与我相关
我的任务
分享
public int[] GetNum(int Num_A, int Num_B)
{
int[] out_Num = new int[2];
int line,aRatio,nowRatio,bRatio;
string nowType="";
if (Num_A <= 1000 && Num_B <= 1000)
{
out_Num[0] = Num_A;
out_Num[1] = Num_B;
return out_Num;
}
line=2000 - ( Num_A + Num_B );
aRatio = Math.Min(Num_A, Num_B);
nowType = Num_A > Num_B ? "a" : "b";
if (((2000 - line) - aRatio) > 1000)
nowRatio = (aRatio + line) * (-1);
else
nowRatio=(2000 - line) - aRatio;
if (nowRatio < 0)
bRatio = (int)Math.Floor(Math.Abs(1000 / nowRatio) * 1000) ;
else
bRatio = (2000 - line - nowRatio) ;
if (nowType == "a")
{
out_Num[0]=aRatio;
out_Num[1]=bRatio;
}
else
{
out_Num[0]=bRatio;
out_Num[1]=aRatio;
}
return out_Num;
}