简单题。
#include <stdio.h>
int main(){
int t, m, a, b, temp;
scanf("%d", &t);
while(t-- && scanf("%d", &m)){
a = 0;
while(m-- && scanf("%d", &temp)){
if(!a){
b = temp;
a = 1;
continue;
}
if(temp == b) ++a;
else{
printf("%d %d ", a, b);
a = 1;
b = temp;
}
}
printf("%d %d\n", a, b);
}
return 0;
}