您的位置:首页 > 其它

【MZ 自测题(套路题)】

2016-04-26 16:46 344 查看
#include <map>
#include <cstdio>
#include <iostream>
#define LL long long
using namespace std;

const int MOD1 = 1000000007;
const int MOD2 = 998244353;

typedef pair<int,int> pii;
map<pii,int>MAP;
int s[110];
int cnt = -1,n,m;

int read_int () {
char c = getchar();
int re = 0;
for(;c > '9' || c < '0';c = getchar());
for(;c >= '0' && c <= '9';c = getchar())
re = re * 10 + c - '0';
return re;
}

pii read () {
char c = getchar();
int re1 = 0,re2 = 0;
for(;c > '9' || c < '0';c = getchar());
for(;c >= '0' && c <= '9';c = getchar()) {
re1 = ((LL)re1 * 10 + c - '0') % MOD1;
re2 = ((LL)re2 * 10 + c - '0') % MOD2;
s[++cnt] = c - '0';
}
return make_pair(re1,re2);
}

int main () {
freopen("steam.in","r",stdin);
freopen("steam.out","w",stdout);

scanf("%d%d",&n,&m);

for(int i = 1;i <= m;++i) {
pii t = read();
if(MAP[t]) {
for(int j = 0;j <= cnt;++j)
printf("%d",s[j]);
printf("\n");
}
else MAP[t] = 1;
cnt = -1;
}
}

16MB的内存=。= 典型套路题啊。。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: