题目:POJ2503
我虽然菜,但我也很想喷POJ,为啥C++能过,G++不是超时就是RE?折腾那么长时间,你还不给数据,打扰了,我的锅我的锅。
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <map>
#define MAX 100007
using namespace std;
typedef long long LL;
map<string, string> mp;
map<string, bool> app;
int main() {
ios::sync_with_stdio(0);
string index;
while (1) {
char c, story[12];
if ((c = getchar()) == '\n')
break;
story[0] = c;
int sum = 1;
while ((c = getchar()) != ' ')
story[sum++] = c;
story[sum] = '\0';
cin >> index;
getchar();
mp[index] = story;
app[index] = true;
}
while (cin >> index) {
if (app[index] == false)
cout << "eh" << endl;
else
cout << mp[index] << endl;
}
return 0;
}
作者在解决POJ2503题目时遇到C++和G++表现不一致的问题,C++能通过,而G++要么超时要么运行时错误。代码使用了标准输入输出流,字符串映射等技术。
681

被折叠的 条评论
为什么被折叠?



