|
|
back to boardC++ Accepted void solve() { int n, ans; cin >> n; vector<int> a(n + 1); for (int i = 1; i <= n; i++) { cin >> a[i]; } int cnt = 1; for (int i = 1; i <= n; i++) { if (a[i] == a[i + 1]) { cnt++; } else { cout << cnt << ' ' << a[i] << ' '; cnt = 1; } } } |
|
|