HDU ~ 6292 ~ 赛题分析 (水)

思路:输入的时候维护一个最小值,按要求输出即可。


#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1005;
const int INF = 1000000005;
int main()
{
    //freopen("C:\\Users\\张松超\\Desktop\\in.txt", "r", stdin);
    int T, n, m; scanf("%d", &T);
    for (int k = 1; k <= T; k++)
    {
        scanf("%d%d", &n, &m);
        printf("Problem %d:\n", k+1000);
        int MIN = INF, t;
        for (int i = 0; i < n; i++) scanf("%d", &t), MIN = min(MIN, t);
        printf("Shortest judge solution: %d bytes.\n", MIN);
        MIN = INF;
        for (int i = 0; i < m; i++) scanf("%d", &t), MIN = min(MIN, t);
        if (MIN == INF) printf("Shortest team solution: N/A bytes.\n");
        else printf("Shortest team solution: %d bytes.\n", MIN);
    }
    return 0;
}


猜你喜欢

转载自blog.csdn.net/zscdst/article/details/80497391