20分,求助
查看原帖
20分,求助
920234
froth_reciprocal楼主2023/8/15 20:01

请大佬们不要嘲笑我问这么简单的问题

#1#5AC其余全WA

以下是代码,谢谢各位帮助

#include<iostream>
using namespace std;
int n,a[110],ans=0;
bool vis[110];
int main(){
	ios::sync_with_stdio(false);
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			for(int t=1;t<=n;t++){
				if(t!=i&&t!=j&&!vis[t]&&a[t]==a[i]+a[j]){
					ans++;	
					vis[j]=1;
				}
			}
		}
	}
	cout<<ans<<"\n";
	return 0;
} 

额,我感觉我像是来送咕值的(>▽<)

o( ̄ε ̄*)

谢谢家人们朋友们

2023/8/15 20:01
加载中...