Untitled

mail@pastecode.io avatar
unknown
plain_text
6 months ago
552 B
1
Indexable
Never
#include<stdio.h>
int main(){
	int t;scanf("%d",&t);
	for(int i=1;i<=t;++i){
		int n;scanf("%d",&n);
		int a[n];
		for(int i=0;i<n;++i){
			scanf("%d",&a[i]);
		}
		printf("Test %d: \n",i);
		for(int i=0;i<n;++i){
			int check=1;
			for(int j=0;j<i;++j){
				if(a[i]==a[j]){
					check=0;
					break;
				}
			}
			if(check==1){
				int dem=1;
				for(int j=i+1;j<n;++j){
					if(a[i]==a[j]) ++dem;
				}
				if(dem==1)printf("%d appears %d time\n",a[i],dem);
				else printf("%d appears %d times\n",a[i],dem);
			}
		}
	}
}