HDU 5199/BC 36B Gunner
2015-09-28 21:26
726 查看
读入鸟的时候直接用map存起来 询问的时候访问后清零即可
#include<iostream> #include<cstdio> #include<cstring> #include<cctype> #include<cmath> #include<vector> #include<queue> #include<map> #include<algorithm> #include<set> #define scnaf scanf #define cahr char #define bug puts("bugbugbug"); using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int,int> pii; const int mod=1000000007; const int maxn=1e6+100; const int inf=1e9; int a; inline void RDF(int &ret) //输入为负数 { char c; int sgn; while(c != '-' && (c < '0' || c > '9')) c = getchar(); sgn = (c == '-') ? -1 : 1; ret = (c == '-') ? 0 : (c - '0'); while(c = getchar(), c >= '0' && c <= '9') ret = ret * 10 + (c - '0'); ret *= sgn; } inline void RD(int &ret) //输入为整数 { char c; do { c = getchar(); } while(c < '0' || c > '9'); ret = c - '0'; while((c = getchar()) >= '0' && c <= '9') { ret = ret * 10 + (c - '0'); } } inline void OT(int a) //输出为正数 { if(a >= 10) { OT(a / 10); } putchar(a % 10 + '0'); } map<int,int>mp; int main() { int n,m; while(~scanf("%d%d",&n,&m)) { mp.clear(); for(int i=0; i<n; i++) { RD(a); mp[a]++; } for(int i=0; i<m; i++) { RD(a); OT(mp[a]); puts(""); mp[a]=0; } } }
相关文章推荐
- 关于Glide——一个高效的图片加载和缓存类库
- [LeetCode-283] Move Zeroes(移动零元素)
- ocp-v13-035
- TFS撤销其他人的迁出
- ios导航栏自定义返回按钮后,多出蓝点bug
- CSS3基础总结
- 条件随机场CRF简介
- Perl文件"filename.pl"在windows 命令行无法执行
- 20150928作业
- OK335xS U-boot 环境变量解析
- xml学习之xml介绍
- HDU 5198 /BC 36A Strange Class
- hdu5476 Explore Track of Point 2015上海网络赛
- hdu5478 Can you find it(数学规律)
- Android 动画配置
- 606第三周周六赛F - Proud Merchants
- 第110讲:Akka中的Actor的Monitoring初步解析学习笔记
- poj 1442 Black Box(trap模板 求整个序列的第k大
- ocp-v13-034
- Android得知Scroller(两)——ViewGroup转让scrollTo()