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代码:
 1 #include<bits/stdc++.h>
 2 using namespace std;
 3 int main(){
 4     int t;string str;
 5     while(cin>>t){
 6         getchar();map<string,int> mp;//默认键对应的值为0
 7         while(t--){
 8             cin>>str;
 9             if(mp.find(str)==mp.end()){cout<<"OH GOD"<<endl;mp[str]++;}
10             else{cout<<str<<mp[str]++<<endl;}
11         }
12     }
13     return 0;
14 }

原文地址:https://www.cnblogs.com/acgoto/p/9231333.html

时间: 2024-08-29 04:06:19

ACM_水题你信吗的相关文章

ACM_输出格式(水题)

输出格式 Time Limit: 2000/1000ms (Java/Others) Problem Description: 某水比参加了XX杯,但是他太水,所以三等都木有,所以他决定出一道水题水一水. Input: 输入多组测试数据,每一组一个整数width(3-50),一个整数height(3-50),一个字符串(长度不超过width-2). Output: 对于每个测试实例,要求把字符串按要求输出(字符串处于由width为长,height为宽的矩形的中部), (...倘若不能完全对称,请

ACM_一道耗时间的水题

一道耗时间的水题 Time Limit: 2000/1000ms (Java/Others) Problem Description: Do you know how to read the phone numbers in English? Now let me tell you. For example, In China, the phone numbers are 11 digits, like: 15012233444. Someone divides the numbers into

nyoj 1099 Lan Xiang&#39;s Square (水题)

题目1099 题目信息 运行结果 本题排行 讨论区 Lan Xiang's Square 时间限制:1000 ms  |  内存限制:65535 KB 难度:0 描述 Excavator technology which is strong, fast to Shandong to find Lan Xiang. Then the question comes.. :) for this problem , i will give you four points. you just judge

nyist oj 540 奇怪的排序(水题)

奇怪的排序 时间限制:1000 ms  |  内存限制:65535 KB 难度:1 描述 最近,Dr. Kong 新设计一个机器人Bill.这台机器人很聪明,会做许多事情.惟独对自然数的理解与人类不一样,它是从右往左读数.比如,它看到123时,会理解成321.让它比较23与15哪一个大,它说15大.原因是它的大脑会以为是32与51在进行比较.再比如让它比较29与30,它说29大. 给定Bill两个自然数A和B,让它将 [A,B] 区间中的所有数按从小到大排序出来.你会认为它如何排序? 输入 第一

字符串解密--水题

传纸条 Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 传纸条是一种在课堂上传递信息的老方法,虽然现在手机短信和QQ聊天越来越普及,但是手写的信息会让人感到一种亲切感.对许多学生而言,在学校里传递一些私秘性的信息是一种令人兴奋的打发时光的方式,特别是在一些令人厌烦的课堂上. XX 和 YY 经常在自习课的时候传纸条来传递一些私密性的信息.但是他们的座位相隔比较远,传纸条要通过其他人才能到达对方.在传递过程中,难免会有一些好奇心

2015南阳CCPC L - Huatuo&#39;s Medicine 水题

L - Huatuo's Medicine Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 无 Description Huatuo was a famous doctor. He use identical bottles to carry the medicine. There are different types of medicine. Huatuo put medicines into the bottles and chain these b

sdut 2841 Bit Problem (水题)

题目 贴这个题是因为看题解有更简单的方法, 我做的时候是直接算的, 也很简单. 贴一下题解吧: 如果一个整数不等于 0,那么该整数的二进制表示中至少有一位是 1. 这个题结果可以直接输出 x - (x&(x-1)); 因为x-1 之后二进制下,就是最右边的1变成了0, 最右边的1的 右边所有的0变成了1, 不影响最左边. 我的代码: 1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4

sdut 2413:n a^o7 !(第三届山东省省赛原题,水题,字符串处理)

n a^o7 ! Time Limit: 1000MS Memory limit: 65536K 题目描述 All brave and intelligent fighters, next you will step into a distinctive battleground which is full of sweet and happiness. If you want to win the battle, you must do warm-up according to my inst

杭电(hdu)2053 Switch Game 水题

Switch Game Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 13113    Accepted Submission(s): 7970 Problem Description There are many lamps in a line. All of them are off at first. A series of o