C. Registration system

简介: C. Registration system

题目链接

Problem - 4C - Codeforces


一些话

hash更习惯用数组模拟,所以下意识用了string数组,最终以失败告终

流程

统计字符串数量,用到字符串的hash

字符串的hash用map模拟即可


套路

字符串数量统计:

字符串hash

map<string,int> m;

m[s]++;


ac代码

#include <iostream>
#include <map>
using namespace std;
//统计字符串数量,用map模拟hash
// https://codeforces.com/problemset/problem/4/C
map <string,int> m;
int main(){
    int t;
    cin >> t;
    while(t--){
        string x;
        cin >> x;
        m[x]++;
        if(m[x] == 1) cout << "OK" << endl;
        else cout << x << m[x]-1 << endl;
    }
    return 0;
}
目录
相关文章
|
NoSQL Redis
Consider defining a bean of type ‘com.bsj.system.service.RedisService‘ in your configuration
Consider defining a bean of type ‘com.bsj.system.service.RedisService‘ in your configuration
440 0
Fiori Error message Exception raised without specific error
Fiori Error message Exception raised without specific error
222 0
Fiori Error message Exception raised without specific error
how does gateway framework treat default system flag in customizing
Suppose we have maintain multiple backend system as “default” in customizing:
112 0
how does gateway framework treat default system flag in customizing
workflow initialization in webclient ui - Remote call case
workflow initialization in webclient ui - Remote call case
workflow initialization in webclient ui - Remote call case
How is jsonModel.getProperty implemented
Created by Wang, Jerry, last modified on Jul 11, 2015
89 0
How is jsonModel.getProperty implemented
|
Docker 容器 .NET
System.Drawing.Common在docker报错 The type initializer for 'Gdip' threw an exception
今天在asp.net core站点上做一个发送邮件附带二维码的功能,为了方便邮件接受者直接手机扫描打开特定h5页面。采用QRCoder,代码很简单几行 QRCodeGenerator qrGenerator = new QRCodeGenerator(); QRCodeData qrCodeData = qrGenerator.
4380 0
|
搜索推荐 算法 Python
Recommended System
推荐系统 推荐系统的核心问题就在于为用户推荐与其兴趣相似度比较高的商品。比如在微博上,用户至上想打发时间,并不是想准确的查看某条信息,在首页中查看每一条微博,为了帮助他筛选出一批他们可能感兴趣的信息,此时就需要分析出该用户的兴趣,从海量信息中选择出与用户兴趣相似的信息,并将这些信息推荐给用户。
1228 0