URAL 1496. Spammer
来源:互联网 发布:蓝牙mac地址查询厂商 编辑:程序博客网 时间:2024/05/16 15:28
1496. Spammer
Time limit: 1.0 second
Memory limit: 64 MB
Memory limit: 64 MB
There is a famous spammer among our friends. In the end of every contest he is submitting his incorrect solutions at the speed of a machine-gun. In addition, he cheats by means of using several accounts for debugging. The judges eventually decided to disqualify the spammer. For that, they first want to discover all of his debugging accounts. The judges know which teams submitted their solutions in the last ten minutes of a contest. They regard as the spammer's debugging accounts all accounts which submitted solutions at least twice during the last ten minutes of the contest. Your task is to find these accounts.
Input
The first line contains the number N of submissions in the last 10 minutes (0 ≤ N ≤ 100). The nextN lines contain the names of teams which submitted their solutions in this period. The names contain only digits and lowercase English letters. Each name is not longer than 30 symbols.
Output
Output in an arbitrary order all accounts which, in the judges' opinion, are used by the spammer.
Sample
11naucodericemanabikbaevabikbaevpetrabikbaevabikbaevxabikbaevacrushx
xabikbaev
题意:输出出现过不少于两次的字符串。
解析:map直接搞。
AC代码:
#include <cstdio>#include <map>#include <string>#include <iostream>using namespace std;map<string, int> a;int main(){ #ifdef sxk freopen("in.txt", "r", stdin); #endif //sxk int n; string s; while(scanf("%d", &n)==1){ while(n--){ cin>>s; a[s] ++; } map<string, int>::iterator it; for(it = a.begin(); it !=a.end(); it ++){ if(it->second >= 2) cout<<it->first<<endl; } } return 0;}
0 0
- URAL 1496. Spammer
- URAL
- 【ural】
- URAL
- URAL
- URAL
- URAL
- URAL
- URAL
- URAL
- URAL
- URAL
- URAL
- URAL
- URAL
- URAL
- URAL
- URAL
- LeetCode 104 Maximum Depth of Binary Tree
- LeetCode 100 Same Tree
- LeetCode 191 Number of 1 Bits
- URAL 1925. British Scientists Save the World
- 分布式系统架构之框架化服务
- URAL 1496. Spammer
- Unity3d 基于物理渲染Physically-Based Rendering之实现
- 1027. Colors in Mars (20)
- Android Bitmap 和 BitmapDrawable的区别
- bzoj 2755: [SCOI2012]喵星人入侵
- 三大框架整合步骤
- 2015年03月06日 - Java学习笔记06--正则表达式
- Android工程文件下assets文件夹与res文件夹的区别
- 安装 Fedora 21 工作站后要做的10件事情