zoukankan      html  css  js  c++  java
  • POJ 1002

    #include<iostream>
    #include<set>
    #include<stdio.h>
    #include<string>
    #include<algorithm>
    using namespace std;

    string _m[100005];
    int main()
    {
        //freopen("acm.acm","r",stdin);
        int num;
        int i;
        int j;
        int past;
        int t;
        int u;
        int index;
        int time = 0;
        string s1;
        string s2;
        string::iterator pos2;
        char mp[26] = {'2','2','2','3','3','3','4','4','4','5','5','5','6','6','6','7',' ','7','7','8','8','8','9','9','9'};
        scanf("%d",&num);
        for(i = 0; i < num; ++ i)
        {
            cin>>s1;
            for(pos2 = s1.begin();pos2 != s1.end(); )
            {
                if(*pos2 == '-')
                    s1.erase(pos2);
                else
                {
                    if(*pos2 >= 'A' && *pos2 <= 'Z')
                    {
                    *pos2 = mp[*pos2-'A'];
                    }
                    ++ pos2;
                }
            }
            s1.insert(s1.begin()+3,'-');
            _m[i] = s1;
        }
        sort(_m,_m + num);
        s2 = _m[0];
        j = 0;
        for(t = 0; t < num; ++ t)
        {
            if(_m[t] == s2)
                ++ j;
            else
            {
                if(j > 1)
                {        
                    time = 1;
                    cout<<s2;
                    cout<<' '<<j<<endl;
                }    
                s2 = _m[t];
                -- t;
                j = 0;
            }
        }
        if(j > 1)
        {        
            time = 1;
            cout<<_m[num - 1];
            cout<<' '<<j<<endl;
        }    
        if(time == 0)
            cout<<"No duplicates. "<<endl;
    }


  • 相关阅读:
    Enables DNS lookups on client IP addresses 域名的分层结构
    移除 URL 中的 index.php
    Design and Architectural Goals
    The Model represents your data structures.
    If a cache file exists, it is sent directly to the browser, bypassing the normal system execution.
    UNION WHERE
    cookie less
    http 2
    UNION DISTINCT
    联合约束 CONCAT()
  • 原文地址:https://www.cnblogs.com/gavinsp/p/4563052.html
Copyright © 2011-2022 走看看