# 3107. 数据交换

1） input 输入

2） process 处理交换

3） output 输出

//* Specification of input *

void input(int* p, int n);

/* PreCondition:

p points to an array with n integers

PostCondition:

enter and store n integers into an array pointed by p

*/

//* Specification of process *

void process(int* p, int n);

/* PreCondition:

p points to an array with n integers

PostCondition:

swap smallest number with the first number of an array pointed by p,

and swap largest number with the last number

*/

//* Specification of output *

void output(int* p, int n);

/* PreCondition:

p points to an array with n integers

PostCondition:

print each element of an array pointed by p in one line, with one blank between elements.

*/

/*********/

/ /

/ DON'T MODIFY main function ANYWAY! /

/ /

/*********/

### define N 10

//* Specification of input *

void input(int* p, int n)

/* PreCondition:

p points to an array with n integers

PostCondition:

enter and store n integers into an array pointed by p

*/

{ //TODO: your function definition

}

//* Specification of process *

void process(int* p, int n)

/* PreCondition:

p points to an array with n integers

PostCondition:

swap smallest number with the first number of an array pointed by p,

and swap largest number with the last number

*/

{ //TODO: your function definition

}

//* Specification of output *

void output(int* p, int n)

/* PreCondition:

p points to an array with n integers

PostCondition:

print each element of an array pointed by p in one line,

with one blank between elements.

*/

{ //TODO: your function definition

}

/*********/

int main()

{ int a[N],n;

scanf(“%d”,&n);

//* functions input, process, output are called here ***

input(a,n);

process(a,n);

output(a,n);

//************

return 0;

}

-

-

### 样例

Input
-

Output
-


334 人解决，373 人已尝试。

386 份提交通过，共有 1309 份提交。

2.0 EMB 奖励。