30分 在洛谷和其他编译环境中的输出不一样
查看原帖
30分 在洛谷和其他编译环境中的输出不一样
1478271
ytx000楼主2024/10/29 17:06
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n, x = 0;
	cin>>n;
	int a[n];
	for(int i = 0; i < n; i++) {
		cin>>a[i];
	}
	for(int i = 0; i < n; i++) {
		for(int j = i + 1; j < n; j++) {
			int num = a[i] + a[j];
			for(int k = 0; k < n; k++) {
				if(a[k] == num) {
					x++;
				}
			}
		}
	}
	cout<<x;
	return 0;
} 

求助!!!!

2024/10/29 17:06
加载中...