题解 | #找最小数#map存储#直接结果

找最小数

https://www.nowcoder.com/practice/ba91786c4759403992896d859e87a6cd

#include <stdio.h>
#include <map>
#include <string>
using namespace std;
int main(){
    map<string,int> mp;
    int a;
    scanf("%d",&a);
    getchar();
    string str;
    for(int i=0;i<a;i++){
        char arr[10]={0};
        scanf("%[^\n]",arr);
        getchar();
        str=arr;
        mp[str]=i;
    }
    printf("%s",mp.begin()->first.c_str());
}

#一人推荐一个机械人值得去的公司##机械人春招想让哪家公司来捞你?##软件开发薪资爆料##23届找工作求助阵地##稳定和高薪机械人更看重哪个?#
全部评论

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务