PAT5-06. 航空公司VIP客户查询

来源:互联网 发布:苹果电脑mac怎么截图 编辑:程序博客网 时间:2024/05/01 02:30

用iostream读取是很耗时间的

#include<unordered_map>#include<string>#include<iostream>using namespace std;int main(){  unordered_map<string,int>man;  char id[30];  int n,thresh;  scanf("%d %d",&n,&thresh);  while(n--){    int b;scanf("%s %d",id,&b);    man[string(id)]+=max(b,thresh);  }  int m;scanf("%d",&m);  while(m--){    scanf("%s",id);string a(id);    if(man.count(a)==0)      printf("No Info\n");    else printf("%d\n",man[a]);  }  return 0;}



0 0
原创粉丝点击