hp_68
1
My issue
My code
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int a[10];
for(int i=0; i<10; i++){
cin>>a[i];
a[i]=a[i]%42;
}
sort(a, a+10);
int count=0;
for(int i=1; i<10; i++){
if(a[i]==a[i-1]) count++;
}
cout<<10-count<<endl;
return 0;
}
Problem Link: NSIT13 Problem - CodeChef
@hp_68
u have to take 10 test cases as well.
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int t;
t=10;
while(t--)
{
int a[10];
for(int i=0; i<10; i++){
cin>>a[i];
a[i]=a[i]%42;
}
sort(a, a+10);
int count=0;
for(int i=1; i<10; i++){
if(a[i]==a[i-1]) count++;
}
cout<<10-count<<endl;
}
return 0;
}
Like this…