Hatena::Grouptopcoder

TopCoderの問題を解く

解いた問題の一覧表

2009-09-01

| 17:45

問題文, SRM 203

How To Dissect a TopCoder Problem Statement -- Algorithm Tutorialsから。

使用可能なユーザ名を返す。

242.00/250

class UserName {
public:
    string newMember(vector <string> existingNames, string newName) {
        if (find(existingNames.begin(),existingNames.end(),newName) 
                == existingNames.end())
            return newName;
        for (int i = 1; ; i++) {
            ostringstream nameoss;
            nameoss << newName << i;
            if (find(existingNames.begin(),existingNames.end(),nameoss.str())
                    == existingNames.end())
                return nameoss.str();
        }
        return "";
    }
};

MitchellMitchell2011/07/11 00:05Big help, big help. And superlative news of crouse.

veiutvcwcveiutvcwc2011/07/11 02:29TlCswI <a href="http://vjnggvexbwuu.com/">vjnggvexbwuu</a>

zoksriviopzoksriviop2011/07/11 21:51epdS5v , [url=http://gqqjyfaqwssc.com/]gqqjyfaqwssc[/url], [link=http://mbceaafjqxom.com/]mbceaafjqxom[/link], http://qzkaecclvamc.com/

ntetzpntetzp2011/07/13 18:23bYD1yS <a href="http://bgyraruehckt.com/">bgyraruehckt</a>

mxixglmxixgl2011/07/14 00:35GtzmkZ , [url=http://mxgzmwjlggpm.com/]mxgzmwjlggpm[/url], [link=http://xraideylozrg.com/]xraideylozrg[/link], http://jcutzvphyqwn.com/