diff --git a/2768_midupng/main.cpp b/2768_midupng/main.cpp index cbc443b..15fde5f 100644 --- a/2768_midupng/main.cpp +++ b/2768_midupng/main.cpp @@ -1,63 +1,70 @@ -//weiwancheng +#include #include -#include using namespace std; int main() { - int xy,r; + int xy, r; //bool a[251][251]={0}; - int ans[252][252]={0}; - cin>>xy>>r; - for(int i=1;i<=xy;i++){ - for(int j=1;j<=xy;j++){ + int ans[252][252] = { 0 }; + cin >> xy >> r; + for (int i = 1; i <= xy; i++) { + for (int j = 1; j <= xy; j++) { bool u; - cin>>u; - if(u==1){ - printf("(%d,%d):",i,j); - int qx=i-r,qy=j-r; - int hx=i+r+1,hy=j+r+1; - if(qx<1){ - qx=1; + cin >> u; + if (u == 1) { + // printf("(%d,%d):", i, j); + int qx = i - r, qy = j - r; + int hx = i + r + 1, hy = j + r + 1; + if (qx < 1) { + qx = 1; } - if(qy<1){ - qy=1; + if (qy < 1) { + qy = 1; } - if(hx>xy){ - hx=xy+1; + if (hx > xy) { + hx = xy + 1; } - if(hy>xy){ - hy=xy+1; + if (hy > xy) { + hy = xy + 1; } - printf("%d %d %d %d ",qx,qy,hx,hy); + // printf("(%d,%d) (%d,%d) ", qx, qy, hx, hy); ans[qx][qy]++; - ans[i][hy]--; - ans[j][hx]--; - ans[hx][hy]--; - printf("%d %d %d %d\n",ans[qx][qy],ans[i][hy],ans[j][hx],ans[hx][hy]); + ans[qx][hy]--; + ans[hx][qy]--; + ans[hx][hy]++; + // printf("(%d,%d) (%d,%d)\n", i,hy,j,hx); } } } - - for(int i=1;i<=xy;i++){ - for(int j=1;j<=xy;j++){ - // ans[i][j]+=ans[i-1][j]+ans[i][j-1]-ans[i-1][j-1]; - cout<