您的位置:首页 > 其它

Sicily 2593 Begin the contest with a very easy problem (难得水题)

2012-05-07 17:23 417 查看
找最值。

#include <stdio.h>

int main()
{
int te;
int n;
int min;
int max;
int t;
scanf("%d", &te);
while(te--)
{
scanf("%d", &n);
scanf("%d", &t);
min = t;
max = t;
n--;
while(n--)
{
scanf("%d", &t);
if(t > max)
{
max = t;
}
if(t < min)
{
min = t;
}
}
printf("%d\n", max - min);
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: