1117: 查找数组元素
import java.util.Scanner;
public class Main {
static int []a = new int[1010];
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
int n=cin.nextInt();
for(int i=0;i<n;i++)
a[i]=cin.nextInt();
int u=cin.nextInt();
int flag=0;
for(int i=0;i<n;i++)
{
if(a[i]==u)
{
flag=1;
break;
}
}
if(flag==0) System.out.println("Not Found");
else
{
int i;
for(i=0;i<n;i++)
if(a[i]==u) break;
else System.out.printf("%4d",a[i]);
i++;
for(;i<n;i++)
System.out.printf("%4d",a[i]);
}
}
}