Markdown
by songhongyi @ 2019-04-15 15:45:00
Markdown
by yubaiqi23 @ 2019-04-15 16:44:55
```cpp
#include<stdio.h>
int main(){
int a[101],b[101]={0},c;
scanf("%d",&c);
for(int i=0;i<c;i++){
scanf("%d",&a[i]);
}
for(int i=0;i<c;i++)
for(int j=c-1;j>=i;j--){
if(a[j]<a[j-1]){
int t;
t=a[j];
a[j]=a[j-1];
a[j-1]=t;
}
}
for(int i=0;i<c;i++){
int e=i+1,f=i+2;
while(f<c){
if(a[i]!=a[e]){
if(a[i]+a[e]>a[f])
f++;
if(a[i]+a[e]<a[f])
e++;
if(a[i]+a[e]==a[f]){
b[f]=1;
f++;
e++;
}
}
else
e++;
}
}
int t=0;
for(int i=0;i<c;i++)
if(b[i]==1)
t++;
printf("%d",t);
return 0;
}
```
帮下忙
by DJ菜得真实 @ 2019-04-15 23:09:39
我知道了,排序算法有问题
by DJ菜得真实 @ 2019-04-16 01:09:26