直接贴上代码了
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int main()
{
int cas, p, temp, x = -0x3f3f3f3f, xx = 0x3f3f3f3f;
char s[20];
scanf("%d", &cas);
while(cas -- )
{
x = -0x3f3f3f3f, xx = 0x3f3f3f3f;
scanf("%s", s);
scanf("%d", &p);
if(strcmp(s, "Faster") == 0)
{
while(p --)
{
scanf("%d", &temp);
if(temp < xx) xx = temp;
}
printf("%d\n", xx);
}
else
{
while(p --)
{
scanf("%d", &temp);
if(temp > x) x = temp;
}
printf("%d\n", x);
}
}
return 0;
}