为啥只对了1个点
查看原帖
为啥只对了1个点
1320771
Gavinzhou楼主2024/5/6 13:00
#include <iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int cnt=0;
int main(){
    int n;
    cin>>n;
    int a[10000];
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    for(int i= 1;i<=n;i++){
        for(int j=1+i;j<=n;j++){
            if (pow(sqrt(a[i]+a[j]),2)==a[i]+a[j])
                cnt++;
        }
    }
    cout<<cnt;
    return 0;
}
2024/5/6 13:00
加载中...