ZOJ 2970: Faster, Higher, Stronger
1 #include <iostream> 2 #include <string> 3 #include <algorithm> 4 using namespace std; 5 int a[2008]; 6 int main() { 7 int T; 8 cin >> T; 9 string s; 10 int N; 11 while (T--) 12 { 13 cin >> s >> N; 14 for (int i = 0; i<N; i++)cin >> a[i]; 15 switch (s[0]) 16 { 17 case ‘F‘:cout << *min_element(a, a + N); break; 18 default:cout << *max_element(a, a + N); 19 } 20 cout << endl; 21 } 22 return 0; 23 }
时间: 2024-11-06 01:03:50