// Query the console using the binary method. write ("Enter data count:"); int n = convert. toint32 (console. readline (); int [] NO = new int [N]; int x = 0, y = n-1; // X and Y respectively assign values to the defined array (arrays in ascending order by default, otherwise, you must sort the array elements.) For (INT I = 0; I <n; I ++) {console. write ("input data {0 }:", I + 1); no [I] = convert. toint32 (console. readline ();} console. clear (); // clear the console. write ("Enter the number of queries:"); int sel = convert. toint32 (console. readline ()); // Bipartite while (Y> = x) {int ZJ = (x + y)/2; // ZJ is X, if (SEL = No [ZJ]) // determines whether the query value is an intermediate element of this group of elements {console. writeline ("No. {0} element! ", ZJ + 1); break;} else if (SEL <no [ZJ]) // the query value is smaller than the intermediate element, then, the first digit of the intermediate element serves as the maximum element {Y = ZJ-1;} else if (SEL> no [ZJ]) of the next element. // the query value is greater than the intermediate element, then, the last digit of the intermediate element serves as the minimum element of the next element {x = ZJ + 1 ;}}if (Y <X) {console. writeline ("No such count! ");}
140825 ● bipartite