Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int putere, pas, n, a[520][520];
- void f(int i, int j, int k)
- {
- if(k==1)
- {
- printf("%d %d ",a[i][j],a[i+1][j+1]);
- printf("%d %d ",a[i][j+1],a[i+1][j]);
- }
- else if(k>1)
- {
- f(i,j,k/2);
- f(i+k,j+k,k/2);
- f(i,j+k,k/2);
- f(i+k,j,k/2);
- }
- }
- int main()
- {
- freopen("matrice_div_et_imp.in","r",stdin);
- freopen("matrice_div_et_imp.out","w",stdout);
- scanf("%d",&putere);
- if(putere==0)
- {
- scanf("%d",&pas);
- printf("%d",pas);
- return 0;
- }
- n=(1<<putere);
- pas=(n>>1);
- for(int i=1;i<=n;i++)
- for(int j=1;j<=n;j++) scanf("%d",&a[i][j]);
- f(1,1,pas);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement