Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void swap(int &a, int &b) {
- int temp = a;
- a = b;
- b = temp;
- }
- int main() {
- int T, N;
- int AoP[10];
- cin >> T;
- for(int i = 1; i <= T; i++) {
- cin >> N;
- for(int j = 0; j < N; j++)
- cin >> AoP[j];
- for(int j = 0; j < N - 1; j++)
- for(int k = j + 1; k < N; k++)
- if(AoP[j] > AoP[k])
- swap(AoP[j], AoP[k]);
- cout << "Case " << i << ": " << AoP[N / 2] << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement