CCF markDown

求改错啊,怎么改就是60分,测了很多组样例,就是不对,救命啊

#include
using namespace std;

vector v_s;

void solve_h(string &s)
{
    int hx = 0, i;
    int len = s.size();
    for(i = 0; i < len; i++){
        if(s[i] == '#')
            hx++;
        if(s[i] != ' ' && s[i] != '#')
            break;
    }
    s = s.substr(i, len-i+1);
   // if(hx >= 6) hx = 6;
    char hsum = hx + '0';
    s = "

" + s + "

"; len = s.size(); s[2] = hsum, s[len-2] = hsum; } string solve_in(string s1) { string s = ""; int len = s1.size(); bool flag = false; for(int i = 0; i < len; i++){ if(s1[i] == '_'){ if(!flag){ s = s + ""; flag = true; } else{ s = s + ""; flag = false; } } else if(s1[i] == '['){ string ss = ""; for(int j = i; j < len; j++){ if(s1[j] == '('){ bool flags = false; for(int k = j+1; s1[k] != ')'; k++){ if(s1[k] == '_'){ if(!flags){ flags = true; ss = ss + ""; } else{ flags = false; ss = ss + ""; } } else{ ss = ss + s1[k]; } } break; } } s = s + ""; } else if(s1[i] == ']'){ s = s + ""; for(i; i < len; i++){ if(s1[i] == ')') break; } //i++; } else{ s = s + s1[i]; // cout << "@@@ " << s1[i] << endl; } } //cout <<"@@@ " << s << endl; return s; } int main() { string s; bool flagp = false, flagh = false, flagu = false; while(getline(cin, s)){ if(s == "" ){ // if(s == "!!!") // break; if(flagp){ int vsize = v_s.size(); v_s[vsize-1] = v_s[vsize-1] + "

"; flagp = false; } if(flagu){ int vsize = v_s.size(); v_s[vsize-1] = v_s[vsize-1] + ""; flagu = false; } continue; } s = solve_in(s); if(s[0] == '#'){ flagh = true; solve_h(s); v_s.push_back(s); } else if(s[0] == '*'){ //cout <<"!!!" <"; s = ss; } else{ s = "
  • " + s + "
  • "; } v_s.push_back(s); } else{ if(!flagp){ s = "

    " + s; v_s.push_back(s); flagp = true; } else v_s.push_back(s); } } if(flagp){ int vsize = v_s.size(); v_s[vsize-1] = v_s[vsize-1] + "

    "; } if(flagu){ int vsize = v_s.size(); v_s[vsize-1] = v_s[vsize-1] + ""; } for(int i = 0; i < v_s.size(); i++) cout << v_s[i] << endl; return 0; } /* # Hello ## Hello! ######## hello * 11 * 22 * 33 * 44 Hello, world!_aaa_bbb [good,](morning) [aaa](_bbb_) good,morning [aaa_aa_bbb_ccc_](bbb) !!! */ /* # heading ## sub-heading pdefe dfe _dfefe_ busdfe sdfe fe efewfew buiuhkj dewf: * sfwef * wefe * fewfe A [sdsd](ssf_ hjkhj _kjjk _odj_). # Heading ## Sub-heading Paragraphs are separated by a blank line. text attributes _italic_. Bullet list: * _apples_ * oranges * pears A [link](http://example.com). */

     

    你可能感兴趣的:(CCF)