1 solutions
-
0
#include<bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin>>n; int a[505]; for(int i=1;i<=n;i++){ cin>>a[i]; } int ans=0; for(int i=1;i<=n;i++){ for(int j=i+1;j<=n;j++){ if(a[i]+a[j]==0){ ans++; } } } cout<<ans<<endl; }
- 1
Information
- ID
- 287
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 2
- Tags
- # Submissions
- 52
- Accepted
- 31
- Uploaded By