3 solutions
-
0
#include <iostream> #define int long long #define endl '\n' #define QAQ ios::sync_with_stdio(false),cin.tie(0),cout.tie(0) using namespace std; const int N=1e5+5; int a[N]={0},b[20]={0}; signed main() { QAQ; int n,ans=0; cin>>n; for(int i=1;i<=n;i++) { cin>>a[i]; b[a[i]%8]++; } for(int i=1;i<=n;i++) { if(a[i]%8!=4&&a[i]%8!=0) ans+=b[8-a[i]%8]; else ans+=b[a[i]%8]-1; b[a[i]%8]--; } cout<<ans; return 0; }
Information
- ID
- 6977
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 9
- Tags
- (None)
- # Submissions
- 225
- Accepted
- 12
- Uploaded By