Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- unsigned p[1001][1001];
- int main()
- {
- unsigned x,y,n,m,day=2,i,j,y1,x1,c_day;
- cin>>x>>y>>n>>m;
- cout<<endl;
- y1=y-1;
- while (y1)
- {
- p[x][y1]=day;
- day++;y1--;
- }
- day=2;y1=y+1;
- while (y1<=m)
- {
- p[x][y1]=day;
- y1++;day++;
- }
- //*/
- p[y][x]=1; day=2;
- y1=y-1;
- while (y1)
- {
- p[y1][x]=day;
- x1=x-1;
- c_day=day+1;
- while (x1)
- {
- p[y1][x1]=c_day;
- c_day++;
- x1--;
- }
- c_day=day+1;x1=x+1;
- while (x1<=m)
- {
- p[y1][x1]=c_day;
- c_day++;x1++;
- }
- y1--;
- day++;
- }
- y1=y+1; day=2;
- while (y1<=n)
- {
- p[y1][x]=day;
- x1=x-1;
- c_day=day+1;
- while (x1)
- {
- p[y1][x1]=c_day;
- c_day++;
- x1--;
- }
- c_day=day+1;x1=x+1;
- while (x1<=m)
- {
- p[y1][x1]=c_day;
- c_day++;
- x1++;
- }
- y1++;
- day++;
- }//*/
- for (i=1;i<=n;i++) {
- for (j=1;j<=m;j++)
- cout<<p[i][j]<<" ";
- cout<<"\n";
- }
- return 0;
- }//*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement