注解
1、找最小值。水题。
2、注意根据题目给出的范围赋初始值。
代码
#include <iostream>
using namespace std;
int main(){
int T;
cin>>T;
for(int i=1; i<=T; i++){
int n, m;
cin>>n>>m;
int y = 65537;
int z = 65537;
for(int j=0; j<n; j++){
int t;
cin>>t;
if(t<y){
y = t;
}
}
for(int j=0; j<m; j++){
int t;
cin>>t;
if(t<z){
z = t;
}
}
cout<<"Problem "<<(i+1000)<<":"<<endl;
cout<<"Shortest judge solution: "<<y<<" bytes."<<endl;
cout<<"Shortest team solution: ";
if(z==65537){
cout<<"N/A bytes."<<endl;
}
else{
cout<<z<<" bytes."<<endl;
}
}
return 0;
}