1 solutions
-
0
C++ :
#include <bits/stdc++.h> using namespace std; int a[1005]; int main(){ int n,ans = 0; 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++){ int s = a[i] + a[j]; int k = sqrt(s); if (k*k == s){ // cout << a[i] << " " << a[j] << " " << s << endl; ans ++; } } } cout << ans; return 0; }
- 1
Information
- ID
- 145
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- 10
- Tags
- # Submissions
- 1
- Accepted
- 1
- Uploaded By