# Include <stdio. h>
# Include <stdlib. h>
# Deprecision NUM 100
Typedef struct node
{
Int x;
Int y;
} Node;
Node global [NUM] = {-999 };
Int count = 0;
Int find (int left, int right, node x)
{
Int mid = (left + right)/2;
If (left = mid)
{
If (x. x = global [right]. x)
Return right;
Else if (x. x = global [left]. x)
Return left;
Else
Return-1;
}
Else if (x. x> global [mid]. x)
Return find (mid, right, x );
Else
Return find (left, mid, x );
}
Int main ()
{
Int I = 0, j = 0;
Struct node temp;
For (I = 0; I <NUM; I ++)
{
J = I * I;
Temp. x = j;
Printf ("(% d)", temp. x );
Global [I]. x = j;
}
Printf ("\ n ");
Temp. x = 0;
Find (0, NUM-1, temp );
For (I = 0; I <NUM; I ++)
{
Temp. x = global [I]. x;
Printf ("result is {% d} \ n", find (0, NUM-1, temp ));
}
Printf ("new \ n ");
While (scanf ("% d", & j)
{
Temp. x = j;
Printf ("result is {% d} \ n", find (0, NUM-1, temp ));
}
}
From chenbingchenbing's column