Small fixes
This commit is contained in:
parent
6e5d01fb9c
commit
5cf049704f
|
@ -7,10 +7,10 @@ bool isPrime (int num) {
|
||||||
|
|
||||||
if (num < 2)
|
if (num < 2)
|
||||||
return false;
|
return false;
|
||||||
for(i = 3; i < sqrt(num); i++)
|
for(i = 3; i < sqrt(num); i += 2)
|
||||||
if(num % i == 0)
|
if(num % i == 0)
|
||||||
return false;
|
return false;
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void countProducts() {
|
void countProducts() {
|
||||||
|
@ -23,7 +23,7 @@ void countProducts() {
|
||||||
else
|
else
|
||||||
np++;
|
np++;
|
||||||
}
|
}
|
||||||
if((n1 == p && n2 == np) || n1 + n2 == p || n1 + n2 == np)
|
if ((n1 == p && n2 == np) || n1 + n2 == p || n1 + n2 == np)
|
||||||
printf("ROGeRIO POH DEIXAR ESSX AQUI ENTRAR QUE TA LIMPO\n");
|
printf("ROGeRIO POH DEIXAR ESSX AQUI ENTRAR QUE TA LIMPO\n");
|
||||||
else if (p == np && np == 0)
|
else if (p == np && np == 0)
|
||||||
printf("vei sem nada neah? vai gasta moh grana ai dentro\n");
|
printf("vei sem nada neah? vai gasta moh grana ai dentro\n");
|
||||||
|
@ -33,7 +33,7 @@ void countProducts() {
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(){
|
int main(){
|
||||||
int n;
|
int n = 0;
|
||||||
|
|
||||||
for(scanf(" %d", &n); n > 0; n--)
|
for(scanf(" %d", &n); n > 0; n--)
|
||||||
countProducts();
|
countProducts();
|
||||||
|
|
|
@ -34,12 +34,11 @@ bool isRepeated (char **words, int i, int size) {
|
||||||
int countRepetitions (char **words, int size) {
|
int countRepetitions (char **words, int size) {
|
||||||
int i, repetitions = 0;
|
int i, repetitions = 0;
|
||||||
|
|
||||||
for (i = 0; i < size - 1; i++) {
|
for (i = 0; i < size; i++) {
|
||||||
if (isRepeated(words, i, size))
|
if (isRepeated(words, i, size))
|
||||||
repetitions++;
|
repetitions++;
|
||||||
free(words[i]);
|
free(words[i]);
|
||||||
}
|
}
|
||||||
free(words);
|
|
||||||
return repetitions;
|
return repetitions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue