蒟蒻求助,为何只有两个ac
查看原帖
蒟蒻求助,为何只有两个ac
584631
Xeon_GT楼主2021/12/22 20:43
#include<iostream>
#include<string>
using namespace std;
string strall;
int n,k;
char t = '0';
int main() {
	cin >> strall;
	n = strall.length();
	for (int i = 1; i < n; i++) {
		string strtemp;
		cin >> strtemp;
		strall = strall + strtemp;
	}
	int num[100000] = {};
	for (int j = 0; j < n * n; j++) {
		if (strall[j] == t) {
			num[k]++;
		}
		else {
			num[k + 1]++;
			k++;
			if (t == '0')t = '1';
			else t = '0';
		}
	}
	cout << n<<" ";
	for (int j = 0; j < n*n; j++) {
		if (num[j] != 0) {
			cout << num[j]<<" ";
		}
	}
}
2021/12/22 20:43
加载中...