holylance82
BAN USERusing System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
public static int FindMin( ref int[] arrayInt )
{
int nMin = arrayInt[0];
int nCount = 0;
for (int i = 0; i < arrayInt.Length; i++)
{
if (nMin > arrayInt[i])
{
nMin = arrayInt[i];
nCount++;
}
}
Console.WriteLine("Number of increments: " + nCount);
return nMin;
}
static void Main(string[] args)
{
int[] arrayInt = new int[10];
Random r = new Random();
for (int i = 0; i < 10; i++)
{
arrayInt[i] = r.Next(1, 100);
}
int nMin = FindMin(ref arrayInt);
Console.WriteLine("Min Number: " + nMin);
Console.ReadLine();
}
}
}
x = 5
- holylance82 October 02, 2014101 5
100 5-1
------
100 4
011 4-1
------
000 0
count of bit 1 == 2
---------------------------------
x = 10
1010 10
1001 10-1
------
1000 9
0111 9-1
------
0000 0
count of bit 1 == 2
---------------------------------
111010
111001
--------
111000
110111
--------
110000
101111
--------
100000
011111
--------
000000 0
count of bit 1 == 4