自己试了都能过 就是wa

P1319 压缩技术

PleasantGoat17 @ 2024-03-06 16:51:12

#include<iostream>
#include<cmath>
#include<string.h>
using namespace std;
int main()
{
    string s;
    int cnum[201*201] = {0},cnumlen=0;
    getline(cin,s);

    int numcount =0,lencount =0;

    for(int i=s.length()-1;i>=0;i--)
    {
        while(s[i]!=' ')
        {
            int p = i;
            lencount = 0;
            while(s[p]!=' ')
            {
                if(lencount==0)cnum[numcount] += (s[p]-'0');
                else cnum[numcount] +=(s[p]-'0')*10*lencount;
                lencount++;
                p--;
                if(p<0)break;
            }
            numcount++;
            i = p;
            if(i<0)break;
        }

    }

    int linelen =0;
    int wdh = cnum[numcount-1];
    for(int i=numcount-2;i>=0;i--)
    {
        int number;
        i%2!=0 ? number = 0 : number = 1;

        int outnum = cnum[i];

        while(outnum>0)
        {
            cout << number;
            linelen++;
            outnum--;
            if(linelen==wdh)
            {
            cout << endl;
            linelen = 0;
            }
        }
    }

    return 0;
}

by 12gas890 @ 2024-03-10 16:30:37

这是为什么你知道吗友友


|