密度图(使用差分(错误))
This commit is contained in:
parent
c9ee67e788
commit
411ab83b38
3
2768_midupng/Readme.md
Normal file
3
2768_midupng/Readme.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# 标题
|
||||||
|
|
||||||
|
* 内容
|
1
2768_midupng/doc/Readme.md
Normal file
1
2768_midupng/doc/Readme.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
#
|
BIN
2768_midupng/doc/密度图.pdf
Normal file
BIN
2768_midupng/doc/密度图.pdf
Normal file
Binary file not shown.
64
2768_midupng/main.cpp
Normal file
64
2768_midupng/main.cpp
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
//weiwancheng
|
||||||
|
#include <iostream>
|
||||||
|
#include<cstdio>
|
||||||
|
using namespace std;
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
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++){
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
if(qy<1){
|
||||||
|
qy=1;
|
||||||
|
}
|
||||||
|
if(hx>xy){
|
||||||
|
hx=xy+1;
|
||||||
|
}
|
||||||
|
if(hy>xy){
|
||||||
|
hy=xy+1;
|
||||||
|
}
|
||||||
|
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]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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<<ans[i][j];
|
||||||
|
if(j!=xy){
|
||||||
|
cout<<" ";
|
||||||
|
}else{
|
||||||
|
cout<<endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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<<ans[i][j];
|
||||||
|
if(j!=xy){
|
||||||
|
cout<<" ";
|
||||||
|
}else{
|
||||||
|
cout<<endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
BIN
2768_midupng/main.exe
Normal file
BIN
2768_midupng/main.exe
Normal file
Binary file not shown.
6
2768_midupng/test/in.txt
Normal file
6
2768_midupng/test/in.txt
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
5 1
|
||||||
|
0 1 0 1 1
|
||||||
|
1 0 0 1 1
|
||||||
|
1 0 0 0 0
|
||||||
|
1 1 0 0 0
|
||||||
|
1 0 1 1 1
|
0
2768_midupng/test/in2.txt
Normal file
0
2768_midupng/test/in2.txt
Normal file
0
2768_midupng/test/in3.txt
Normal file
0
2768_midupng/test/in3.txt
Normal file
41
2768_midupng/test/out.txt
Normal file
41
2768_midupng/test/out.txt
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
## z:\Chao\src\2768_midupng\test\in.txt
|
||||||
|
2020/05/02 ÖÜÁù 20:11:44.84
|
||||||
|
(1,2):1 1 3 4 1 -1 -1 -1
|
||||||
|
(1,4):1 3 3 6 1 -1 -1 -1
|
||||||
|
(1,5):1 4 3 6 0 -2 -1 -2
|
||||||
|
(2,1):1 1 4 3 2 -2 -1 -2
|
||||||
|
(2,4):1 3 4 6 2 -1 -1 -1
|
||||||
|
(2,5):1 4 4 6 0 -2 -1 -2
|
||||||
|
(3,1):2 1 5 3 1 -1 -1 -2
|
||||||
|
(4,1):3 1 6 3 1 -3 -3 -1
|
||||||
|
(4,2):3 1 6 4 2 -2 -3 -1
|
||||||
|
(5,1):4 1 6 3 1 -3 -4 -2
|
||||||
|
(5,3):4 2 6 5 1 -1 -3 -1
|
||||||
|
(5,4):4 3 6 6 -2 -1 -3 -1
|
||||||
|
(5,5):4 4 6 6 -1 -3 -3 -2
|
||||||
|
2 0 2 0 -1
|
||||||
|
1 0 -2 0 0
|
||||||
|
2 0 -1 -1 0
|
||||||
|
1 1 -2 -1 0
|
||||||
|
0 0 -3 -1 -1
|
||||||
|
2 2 4 4 3
|
||||||
|
3 3 3 3 2
|
||||||
|
5 5 4 3 2
|
||||||
|
6 7 4 2 1
|
||||||
|
6 7 1 -2 -4
|
||||||
|
|
||||||
|
-----------------------------------------------
|
||||||
|
Process exited after 160 ms with return value 0
|
||||||
|
|
||||||
|
## z:\Chao\src\2768_midupng\test\in2.txt
|
||||||
|
2020/05/02 ÖÜÁù 20:11:44.84
|
||||||
|
|
||||||
|
-----------------------------------------------
|
||||||
|
Process exited after 70 ms with return value 0
|
||||||
|
|
||||||
|
## z:\Chao\src\2768_midupng\test\in3.txt
|
||||||
|
2020/05/02 ÖÜÁù 20:11:44.84
|
||||||
|
|
||||||
|
-----------------------------------------------
|
||||||
|
Process exited after 80 ms with return value 0
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user