1AC,9WA,C语言求助!
查看原帖
1AC,9WA,C语言求助!
825518
UTAsriel楼主2023/1/5 13:47

代码如下:

#include <stdio.h>
#include <string.h>

int main(void){
	int n,sr[101],cf[99],sc=0,pd[10001];
	memset(pd,0,sizeof(pd)); 
	scanf("%d\n",&n);
	for(int a=1;a<=n;a++){
		scanf("%d ",&sr[a]);
	}
	for(int b=1;b<=n;b++){
		for(int c=(b+1);c<=n;c++){
			for(int d;d<=n;d++){
				if(((sr[b]+sr[c])==sr[d])&&(pd[sr[d]]==0)&&(sr[b]!=sr[c])){
					sc++;
					pd[sr[d]]=1;
				}
			}
		}
	}
	printf("%d",sc);
	return 0;
}

等会还要期末考试,可能无法及时回复,请见谅。

2023/1/5 13:47
加载中...