NYOJ628 小媛在努力

原题链接

简单题。

#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;
}


posted on 2014-03-01 23:07  长木Qiu  阅读(121)  评论(0编辑  收藏  举报