CodeGeeX icon indicating copy to clipboard operation
CodeGeeX copied to clipboard

Datapoint CPP/38 has some issue

Open DNXie opened this issue 5 months ago • 0 comments

The datapoint in Humaneval-x CPP/38 has a few lines repeated between declaration and canonical_solution

The declaration is

...
string decode_cyclic(string s){ 
   int l=s.length();
    int num=(l+2)/3;
    string x,output;
    int i;
    for (i=0;i*3<l;i++)
    {

The solution is

    int l=s.length();
    int num=(l+2)/3;
    string x,output;
    int i;
    for (i=0;i*3<l;i++)
    {
        x=s.substr(i*3,3);
        if (x.length()==3) x=x[2]+x.substr(0,2);
        output=output+x;
    }
    return output;


}

DNXie avatar Sep 16 '24 15:09 DNXie