标签:include i++ scan 搜索 out 魔法 col turn div
很玄学
我暴力都没做出来
#include <cstdio> int n,m,x[40001],vis[15001],a[15001],b[15001],c[15001],d[15001]; int main() { //freopen("magic.in","r",stdin); //freopen("magic.out","w",stdout); scanf("%d%d",&n,&m); for (int i = 1;i <= m;i++) { scanf("%d",&x[i]); vis[x[i]]++; } for (int i = 1;i <= n/9;i++) { int sum = 0; for (int j = i*9+2;j <= n;j++) { sum += vis[j-(9*i+1)]*vis[j-(9*i+1)+2*i]; d[j] += sum*vis[j-i]; c[j-i]+=sum*vis[j]; } sum = 0; for (int j = n-(9*i+1);j >= 1;j--) { sum += vis[j+(9*i+1)]*vis[j+(9*i+1)-i]; a[j] += sum*vis[j+2*i]; b[j+2*i] += sum*vis[j]; } } for (int i = 1;i <= m;i++) printf("%d %d %d %d\n",a[x[i]],b[x[i]],c[x[i]],d[x[i]]); return 0; }
标签:include i++ scan 搜索 out 魔法 col turn div
原文地址:https://www.cnblogs.com/fsy2017/p/9931986.html