Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- int main()
- {
- int c,n,m,z;
- ifstream f("zoom_poza.in");
- f>>c>>n>>m>>z;
- ofstream g("zoom_poza.out");
- if(c==1)
- {
- int N=n*z,M=m*z;
- int x,a[N+1][M+1];
- for(int i=0;i<N;i+=z)
- for(int j=0;j<M;j+=z)
- {
- f>>x;
- for(int p=i;p<i+z;++p)
- for(int q=j;q<j+z;++q)
- a[p][q]=x;
- }
- for(int i=0;i<N;g<<'\n',++i)
- for(int j=0;j<M;++j)
- g<<a[i][j]<<' ';
- }
- else
- {
- int a[n+1][m+1];
- for(int i=0;i<n;++i)
- for(int j=0;j<m;++j)
- f>>a[i][j];
- int k,x,y;
- f>>k;
- while(k--)
- {
- f>>x>>y;
- --x;--y;
- if(x<z)
- x=0;
- else
- if(x>n)
- x/=z;
- if(y<z)
- y=0;
- else
- if(y>m)
- y/=z;
- g<<a[x][y]<<' ';
- }
- g<<'\n';
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement