Description
输入一些整数,求最小值
Input
多组测试数据
首先输入1个整数n表示测试组数
然后每行首先输入1个整数m,再输入m个整数
Output
对于每组测试数据输出1行,内容为m个整数的最小值
Sample Input
2
2 1 2
5 3 4 6 9 3
Sample Output
1
3
Source
Code
#include<stdio.h>
#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
for(int i=0;i<n;i++)
{
int m;
cin>>m;
int t;
int k=999999;
while(m--)
{
cin>>t;
if(t<=k)
k=t;
}
cout<<k<<endl;
}
}