#include <iostream>
using namespace std;

int main()
{
    int testcase;
    int a;
    int tmp;
    int max = 0;
    int min = 0;

    cin >> testcase;

    for (int i = 0; i < testcase; i++)
    {
        cin >> a;
        {
            for(int j = 0; j < a; j ++)
            {
                if(j == 0)
                {
                    cin >> tmp;
                    max = tmp;
                    min = tmp;  
                }

                else
                {
                    cin >> tmp;
        
                    if(tmp > max)
                        max = tmp;

                    if(tmp < min)
                        min = tmp; 
                }
            }
            cout << max << " " << min << endl;
            max = 0;
            min = 0;
        }
    } 
    return 0;
}

카테고리:

업데이트:

댓글남기기