不会做,乱作0分,求救QWQ
查看原帖
不会做,乱作0分,求救QWQ
1426889
zjhzjhzjhzjhzjh楼主2025/8/3 20:04
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n,m[100001],cnt = 0;
	cin>>n;
	for(int i = 0;i<n;i++){
		cin>>m[i];
	}
	for(int i = 0;i<n;i++){
		for(int j = 0;j<n;j++){
			if(i!=j){
				int a = m[i]+m[j];
				for(int z = 0;;z++){
					if(z*z==a){
						cnt++;
					}
				}
			}
		}
	}
	cout<<cnt;
    return 0;
}
2025/8/3 20:04
加载中...