1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
#include<iostream> using namespace std; int main(){ int i,n[101],ans=0,check; cin>>i; for(int a=1;a<=i;a++){ cin>>n[a]; } for(int locate=1;locate<=i-1;locate++){ for(int locateplus=locate+1;locateplus<=i;locateplus++){ int result=n[locate]+n[locateplus]; int chongfu=1,num[1000000]; for(check=1;check<=i;check++){ if(result==n[check]){ if(num[result]==1){ continue; }else num[result]=1;ans++; } } } } cout<<ans<<endl; return 0; }
|