Gym - 101350M (map初次用)

#include
#include
#include
#include
#include
#include
using namespace std;

map mp;
int main()
{
    int T;
    scanf("%d",&T);

    while (T--) {
        int C,N;
        scanf("%d%d",&C,&N);
        string c;
        double v;
        for(int i = 0;i < C;i++){
            cin >> c;
            scanf("%lf",&v);
            mp[c] = v;
        }
        mp["JD"]=1;
        string name;
        double sum = 0,num;
        for(int i = 0;i < N;i++){
            scanf("%lf",&num);
            cin >> name;
            sum += mp[name]*num;
        }

        printf("%.6lf\n",sum);
    }
    return 0;
}

你可能感兴趣的:(Gym - 101350M (map初次用))