【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的内存=。= 典型套路题啊。。
相关文章推荐
- 老鸟的Python入门教程
- 模式源于生活:代理模式---中介租房
- 组合的总结
- android 滚动时间选择器
- HELL编程-shell编程实战
- MongoDB -- 3.0用户创建
- PAT 1048. 数字加密(20)
- java 窗口
- 150809207飞机
- Python 多线程 多进程 全局解释器锁GIL join
- Dubbo学习(十三):服务降级
- sdut 2604 Thrall’s Dream 判断一个图是否单侧连通
- OpenCV下的灰度直方图生成及显示的源码,带详细注释!
- go语言特点
- 在Swing下画出各种形状
- [AIR]安卓APK授权加密的研究
- 补矩阵的题目
- 千元机市场的竞争分析
- 提交svn报错说 有 unversioned 的文件
- 本课分2部分讲解: 第一部分,讲解Kafka的概念、架构和用例场景; 第二部分,讲解Kafka的安装和实战。 由于时间关系,今天的课程只讲到如何用官网的例子验证Kafka的安装是否成功。后续课程