Skip to content

Instantly share code, notes, and snippets.

@shohan4556
Created March 5, 2015 07:01
Show Gist options
  • Select an option

  • Save shohan4556/a8c6b8ca3e0724d60632 to your computer and use it in GitHub Desktop.

Select an option

Save shohan4556/a8c6b8ca3e0724d60632 to your computer and use it in GitHub Desktop.
URI 1609 solution
/// URI : 1609
/// Author : Shohanur Rahaman
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int ara[10000];
int main()
{
memset(ara,0,sizeof ara);
int tc,n,i,j,tmp;
scanf("%d",&tc);
while(tc--){
int tmp=0;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&ara[i]); // 1 2 3 2 3 -- output--: 3
tmp++;
}
int t=0;
for(i=0;i<n;i++){
t=ara[i]; // 1
for(j=i+1;j<n;j++){
if(t==ara[j]){
tmp=tmp-1;
break;
}
}
}
printf("%d\n",tmp);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment