Пример #1
0
    internal int DivWithHeap(IntVal0 x, IntVal1 y)
    {
      if (y.Val <= 0)
        throw new Exception();

      if (x.Val <= 0)
        return 0;

      int z = 0;
      while (x.Val >= y.Val)
      {
        x.Val = x.Val - y.Val;
        z++;
      }

      return z;
    }
Пример #2
0
        internal int DivWithHeap(IntVal0 x, IntVal1 y)
        {
            if (y.Val <= 0)
            {
                throw new Exception();
            }

            if (x.Val <= 0)
            {
                return(0);
            }

            int z = 0;

            while (x.Val >= y.Val)
            {
                x.Val = x.Val - y.Val;
                z++;
            }

            return(z);
        }