又做完啦!

ljy123456 爱因斯坦 2022-06-19 21:49:29 2022-06-19 21:50:27 7

#include<bits/stdc++.h> using namespace std; int n,m; int a[40010]; int sum[15010]; int ans[15010][4]; int main() { scanf("%d%d",&n,&m); for(int i=1;i<=m;++i) { scanf("%d",&a[i]); sum[a[i]]++; } for(int t=1;t9<n;++t) { int tem=0; for(int D=9t+2;D<=n;++D) { int A=D-9t-1; int B=A+2t; int C=D-t; tem+=sum[A]sum[B]; ans[C][2]+=sum[D]tem; ans[D][3]+=sum[C]tem; } tem=0; for(int A=n-9t-1;A;A--) { int B=A+2t; int D=A+9t+1; int C=D-t; tem+=sum[C]*sum[D]; ans[A][0]+=sum[B]*tem; ans[B][1]+=sum[A]*tem; } } for(int i=1;i<=m;++i) { printf("%d %d %d %d\n",ans[a[i]][0],ans[a[i]][1],ans[a[i]][2],ans[a[i]][3]); } }

{{ vote && vote.total.up }}

共 4 条回复

ljy123456 爱因斯坦

好的

root 站长
```cpp 
你的代码
``` 
kj123

每一行末尾打2个空格

ljy123456 爱因斯坦

怎么排版啊??????????????