杭电acm4505

<span style="font-size:36px;">#include <stdio.h>

int main() {
	
	int c, n, i, max, ans;
	int a[16], book[102];
	scanf("%d", &c);
	while(c--) {
		
		ans = 0;
		max = 0;
		for(i=1; i<101; i++)
			book[i] = 0;
		scanf("%d", &n);
		for(i=1; i<=n; i++) {
			scanf("%d", &a[i]);
			if(max<a[i])
				max = a[i];
			book[a[i]] ++;
		}
		
		ans += max * 6;
		ans += max * 4;
		for(i=1; i<=max; i++) {
			if(book[i])
				ans += 5;
			ans += book[i];
		}
		
		printf("%d\n", ans);
	}
	
	return 0;
}</span>

posted @ 2015-10-26 20:12  StevenLuke  阅读(90)  评论(0编辑  收藏  举报