zoukankan      html  css  js  c++  java
  • 后缀字符串

     

    样例输

    3
    ba
    a
    aba

    样例输出

    2
    3
    1
    #include <iostream>
    #include <cstring>
    #include <algorithm>
    #include <cmath>
    #include <cstdio>
    #include <map>
    using namespace std;
    const int maxn = 1e5 + 10;
    int n;
    string a[maxn];
    map<string, int>mp;
    int main() {
        //freopen("in","r",stdin);
        ios::sync_with_stdio(0);
        cin >> n;
        for (int i = 0; i < n; i++){
            cin >> a[i];
            for (int j = 0; j < a[i].size(); j++) {
                mp[a[i].substr(j)]++;
                 //cout << a[i].substr(j) << " ";
            }
        }
        for (int i = 0; i < n; i++)
            cout << mp[a[i]] << endl;
        return 0;
    }
  • 相关阅读:
    测光
    闪光灯
    快门
    光圈
    白加黑减
    曝光补偿
    取景雷区
    着眼点
    Web中的无状态含义
    图计算模型[转]
  • 原文地址:https://www.cnblogs.com/xcfxcf/p/12715988.html
Copyright © 2011-2022 走看看