zoukankan      html  css  js  c++  java
  • 第二次作业

    作业地址:https://edu.cnblogs.com/campus/nenu/2016CS/homework/2139

    git仓库: https://git.coding.net/tangjh563/wfAnalysis.git

    时间:

    主要算法:

    void Cwords(){
        map<string,int> wcount;
        bool flag = gnumber();
        bool tmp = false;
        string w;
        string s;
        for (int i = 0;i < zfc.length();i++){
            while(zfc[i] >= '0' && zfc[i] <= '9' || zfc[i] >= 'a' && zfc[i] <= 'z'){
                tmp = true;
                s += zfc[i];
                i++;
            }
            if(tmp){
                w = s;
                if(w[0] > '9' || w[0] < '0'){
                    //vector<int>::iterator result = find( L.begin( ), L.end( ), 3 );
                    ++wcount[w];
                }
                s = "";
                w = "";
                tmp = false;
            }
        }
        if(!flag){
            cout << "total " << wcount.size() << " words" << endl;
            for(map<string,int>::iterator it = wcount.begin() ; it != wcount.end() ; it++)
                cout << left << setw(20) << it->first << it->second << endl;
        }
        else{
            cout << "Total words is " << wcount.size() <<endl;
            cout <<"-----------------------------------------" << endl;
            vector<pir> word_count(wcount.begin() , wcount.end());
            for (int i = 0;i < num1;i++)
                cout << left << setw(20) << word_count[i].first << word_count[i].second << endl;
        }
  • 相关阅读:
    soj#547 bzoj5046 分糖果游戏
    soj#551 loj#2833 帐篷
    nb哒LCA
    soj#532 set p3175
    p4042 [AHOI2014/JSOI2014]骑士游戏
    p1501 [国家集训队]Tree II
    908G New Year and Original Order
    908D New Year and Arbitrary Arrangement
    EZOJ #258
    EZOJ #257
  • 原文地址:https://www.cnblogs.com/tangjh563/p/9733832.html
Copyright © 2011-2022 走看看