ACM_水题你信吗
水题你信吗
Time Limit: 2000/1000ms (Java/Others)
Problem Description:
某发最近又认识了很多妹(han)子,可是妹(han)子一多不免有时会忘记那么一两个,为了记得他们的名字,发哥设计了一个记录器。对于每个他刚认识的妹(han)子,他都把妹子的名字放进记录器里,如果记录器已经有这个妹子的名字,则在这个妹子的名字后面加上一个数字(数字从1开始),输出妹子的名字加上数字。若记录器没有这个妹子的记录,则输出OH GOD。
Input:
(EOF)输入一个数字n表示发哥认识的妹子(1<=N<=10^5),接下来n行每行一个字符串,字符串不超过50个小写字母。输出:如描述。
Output:
如描述。
Sample Input:
6
first
first
second
second
third
first
Sample Output:
OH GOD
first1
OH GOD
second1
OH GOD
first2
解题思路:解决此题使用map容器(键值对)比较简单,水过!
AC代码:
#include<bits/stdc++.h>
using namespace std;
int main(){
int t;string str;
while(cin>>t){
getchar();map<string,int> mp;//默认键对应的值为0
while(t--){
cin>>str;
if(mp.find(str)==mp.end()){cout<<"OH GOD"<<endl;mp[str]++;}
else{cout<<str<<mp[str]++<<endl;}
}
}
return ;
}
ACM_水题你信吗的更多相关文章
- ACM_水题你要信了(修改版)
水题你要信了 Time Limit: 2000/1000ms (Java/Others) Problem Description: 某发最近又认识了很多妹(han)子,可是妹(han)子一多不免有时会 ...
- [ACM_水题] UVA 12502 Three Families [2人干3人的活后分钱,水]
Three Families Three families share a garden. They usually clean the garden together at the end o ...
- [ACM_水题] Yet Another Story of Rock-paper-scissors [超水 剪刀石头布]
Description Akihisa and Hideyoshi were lovers. They were sentenced to death by the FFF Inquisition. ...
- [ACM_水题] UVA 11729 Commando War [不可同时交代任务 可同时执行 最短完成全部时间 贪心]
There is a war and it doesn't look very promising for your country. Now it's time to act. You have a ...
- [ACM_水题] UVA 11292 Dragon of Loowater [勇士斗恶龙 双数组排序 贪心]
Once upon a time, in the Kingdom of Loowater, a minor nuisance turned into a major problem. The shor ...
- [ACM_水题] ZOJ 3706 [Break Standard Weight 砝码拆分,可称质量种类,暴力]
The balance was the first mass measuring instrument invented. In its traditional form, it consists o ...
- [ACM_水题] ZOJ 3714 [Java Beans 环中连续m个数最大值]
There are N little kids sitting in a circle, each of them are carrying some java beans in their hand ...
- [ACM_水题] ZOJ 3712 [Hard to Play 300 100 50 最大最小]
MightyHorse is playing a music game called osu!. After playing for several months, MightyHorse disco ...
- [ACM_水题] 不要62(hdu oj 2089, 不含62和4的数字统计)
Problem Description 杭州人称那些傻乎乎粘嗒嗒的人为62(音:laoer).杭州交通管理局经常会扩充一些的士车牌照,新近出来一个好消息,以后上牌照,不再含有不吉利的数字了,这样一来, ...
随机推荐
- LVS集群的三种工作模式
LVS的三种工作模式: 1)VS/NAT模式(Network address translation) 2)VS/TUN模式(tunneling) 3)DR模式(Direct routing) 1.N ...
- 洛谷 3398 仓鼠找sugar 【模板】判断树上两链有交
[题解] 题意就是判断树上两条链是否有交.口诀是“判有交,此链有彼祖”.即其中一条链的端点的Lca在另一条链上. 我们设两条链的端点的Lca中深度较大的为L2,对L2与另一条链的两个端点分别求Lca, ...
- [K/3Cloud]在插件中根据条件取消表单打开过程
新建一个类,继承自动态表单抽象插件类AbstractBillPlugIn,重写PreOpenForm. /// <summary> /// 销售订单 单据维护界面插件 /// </s ...
- tyvj1117 拯救ice-cream
背景 天好热……Tina顶着那炎炎的烈日,向Ice-cream home走去……可是……停电了……冰淇淋们躺在Ice-cream home的冰柜里,慢慢地……慢慢地……融化…………你说,她能赶在冰 ...
- Non-inclusive cache method using pipelined snoop bus
A non-inclusive cache system includes an external cache and a plurality of on-chip caches each havin ...
- D - Doing Homework 状态压缩 DP
Ignatius has just come back school from the 30th ACM/ICPC. Now he has a lot of homework to do. Every ...
- 未来 Web 设计的 7 大趋势
1.手势代替点击 还记得曾经是怎样滚动网页的吗?将鼠标移到屏幕的右边缘,然后拖动古代称为"滚动栏"的玩意儿: 略微专业点的可能会使用鼠标滚轮,光标键或触控板,这已经率先于大多数的用 ...
- Cocos2d-x教程(34)-三维物体OBB碰撞检測算法
欢迎增加Cocos2d-x 交流群:193411763 个中心点.1个旋转矩阵和3个1/2边长(注:一个旋转矩阵包括了三个旋转轴,若是二维的OBB包围盒则是一个中心点,两个旋转轴,两个1/2边长). ...
- ios oc 代码 转换为 c++ 描述代码编译过程
clang -rewrite-objc main.m #import <Foundation/Foundation.h> #import <objc/runtime.h> // ...
- BNU 13064 Dice (I) 前缀和优化DP
Dice (I) You have N dices; each of them has K faces numbered from 1 to K. Now you have arranged th ...