Skip to content

Commit

Permalink
5624
Browse files Browse the repository at this point in the history
  • Loading branch information
IsuminI authored May 28, 2024
1 parent 6cd4d1d commit e0d4a3a
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions 이수민/5624.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include <stdio.h>
#include <stdlib.h>
int n,arr[5001],dp[400001],cnt;
int main()
{
scanf("%d",&n);
for(int i=0; i<n; i++) {
scanf("%d",&arr[i]);
}

for(int i=0; i<n; i++) {
for(int j=0; j<i; j++) {
if(dp[arr[i] - arr[j] + 200000]) {
cnt++;
break;
}
}

for(int j=0; j<=i; j++) {
dp[arr[i] + arr[j] + 200000] = 1;
}
}
printf("%d",cnt);
return 0;
}

0 comments on commit e0d4a3a

Please sign in to comment.