1534
This commit is contained in:
17
src/1534.c
Normal file
17
src/1534.c
Normal file
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// Created by xfj12 on 2025/4/14.
|
||||
//
|
||||
#include <math.h>
|
||||
#include <solution/1534.h>
|
||||
int countGoodTriplets(int *arr, int arrSize, int a, int b, int c)
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
for (int i = 0; i < arrSize; i++)
|
||||
for (int j = i + 1; j < arrSize; j++)
|
||||
for (int k = j + 1; k < arrSize; k++)
|
||||
if (abs(arr[i] - arr[j]) <= a && abs(arr[j] - arr[k]) <= b && abs(arr[i] - arr[k]) <= c)
|
||||
count++;
|
||||
|
||||
return count;
|
||||
}
|
||||
Reference in New Issue
Block a user