求求帮我看看

P1320 压缩技术(续集版)

kimseol @ 2024-12-07 01:19:56

明明是对的啊为什么判错? 有人帮我看看吗

#include<bits/stdc++.h>
using namespace std;
int main()
{
    string str; cin >> str;
    int N = str.size();
    vector<string>v(N);
    v[0] = str;
    for (int i = 1; i <= N - 1; i++)cin >> v[i];
    cout << N<<" ";
    int num = 0;
    char p = (v[0])[0];
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < N; j++)
        {
            if (p == (v[i])[j])num++;
            else
            {
                cout << num<<" ";
                num = 1;
                p = (v[i])[j];
            }
        }
    }
    cout << num<<" ";
    return 0;
}

|