1 solutions

  • 0
    @ 2025-10-16 13:48:32

    大家不用模仿我用map做

    由于当时在做梦,看见两个值直接上map了

    #include <iostream>
    #include <map>
    #include <string>
    #include <limits>
    int main() {
        std::map<std::string, int> cities;
        std::string city;
        int temp;
        while(std::cin >> city >> temp) {
            cities[city] = temp;
        }
        std::string min_city;
        int min_temp = std::numeric_limits<int>::max();
        for(const auto& pair : cities) {
            if(pair.second < min_temp) {
                min_temp = pair.second;
                min_city = pair.first;
            }
        }
        if(!min_city.empty()) {
            std::cout << min_city << std::endl;
        }
        return 0;
    }
    
    
    • 1

    Information

    ID
    8739
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    1
    Tags
    # Submissions
    6
    Accepted
    1
    Uploaded By