这题没什么难度,只是只要认真按着题目的要求做就行了。
#include <iostream>
using namespace std;
int main()
{
int a,i;
cin>>a;
int b1[50], c1[600],b,c;
for (int j = 0; j < a; j++)
{
cin >> b>> c;
for ( i = 0; i < b; i++)
cin >> b1[i];
if (c == 0) c1[0] = 0;
else for ( i = 0; i < c; i++)
cin >> c1[i];
int x = b1[0], y = c1[0];
cout << "Problem " << 1001 + j << ":" << endl;
for ( i = 0; i != b ; i++)
if (x >= b1[i]) x = b1[i];
cout << "Shortest judge solution: " << x << " bytes." << endl;
if (c1[0] == 0)
cout << "Shortest team solution: N/A bytes." << endl;
else {
for ( i = 0; i != c ; i++)
if (y >= c1[i ]) y = c1[i];
cout << "Shortest team solution: " << y << " bytes." << endl;
}
}
}
[http://acm.hdu.edu.cn/showproblem.php?pid=6292]