poj 2503 Babelfish (map)

xiaoxiao2021-02-28  93

输入很烦,很皮

#include <stdio.h> #include <iostream> #include <string.h> #include <algorithm> #include <map> using namespace std; char s1[12],s2[12],c1[30]; map<string,string>s; int main() { while(gets(c1)) { if(c1[0]=='\0')break;//\0是结束字符,不能等于\n sscanf(c1,"%s %s",s1,s2); s[s2]=s1; // if(c1=='\n')break; } //printf("12313\n"); while(~scanf("%s",s1)) { if(s[s1]!="") cout<<s[s1]<<endl; else printf("eh\n"); } return 0; }

转载请注明原文地址: https://www.6miu.com/read-84324.html

最新回复(0)