import java.io.*;
import java.util.*;
public class Main{
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
static BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));
public static void main(String[] args) throws IOException {
int num = Integer.parseInt(br.readLine());
int[] array = new int[num];
String[] STR = br.readLine().split(" ");
for(int i = 0 ; i < STR.length ; i++){
array[i] = Integer.parseInt(STR[i]);
}
int count = getCount(num, array);
out.write(count + "");
out.flush();
out.close();
br.close();
}
private static int getCount(int num, int[] array) {
int count = 0;
for(int i = 0; i < num; i++) {
label:
for(int j = 0; j < num; j++) {
if(j != i ) {
for(int k = 0; k < num; k++) {
if(k != j && k != i) {
if(array[i] == array[j] + array[k]) {
count++;
break label;
}
}
}
}
}
}
return count;
}
}
洛谷 P2141 [NOIP2014 普及组] 珠心算测验 Java
最新推荐文章于 2024-06-07 08:25:31 发布