Advertisement
a53

Zoom_Poza_OF

a53
Nov 22nd, 2020
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. ifstream fin("zoom_poza.in");
  6. ofstream fout("zoom_poza.out");
  7.  
  8. int main()
  9. {
  10. int c;
  11. fin >> c;
  12. cout << c;
  13. if(c == 1)
  14. { int b[2501][2501];
  15. int a[51][51];
  16. long long i, j, n, m, k, l1, c1, z, constanta, x, x1;
  17. fin >> n >> m >> z;
  18. for (i = 1; i <= n; i++)
  19. for (j = 1; j <= m; j++)
  20. fin >> a[i][j];
  21. for (i = 1; i <= n; i++)
  22. {
  23. constanta = 0;
  24. for (j = 1; j <= m; j++)
  25. {
  26. for (x = 1; x <= z; x++)
  27. for (x1 = 1; x1 <= z; x1++)
  28. b[(i - 1) * z + x1][constanta * z + x] = a[i][j];
  29. constanta++;
  30. }
  31. }
  32. for (i = 1; i <= z * n; i++)
  33. {
  34. for (j = 1; j <= z * m; j++)
  35. fout << b[i][j] << " ";
  36. fout << "\n";
  37. }
  38. }
  39. if (c == 2)
  40. { int b[2501][2501];
  41. long long i, j, n, m, k, l1, c1, z, constanta, x, x1, linie, coloana;
  42. fin >> n >> m >> z;
  43. for (i = 1; i <= n; i++)
  44. for (j = 1; j <= m; j++)
  45. fin >> b[i][j];
  46. fin >> k;
  47. for (i = 1; i <= k; i++)
  48. {
  49. fin >> l1 >> c1;
  50. linie = l1 / z;
  51. if (l1 % z != 0)
  52. linie++;
  53. coloana = c1 / z;
  54. if (c1 % z != 0)
  55. coloana++;
  56. fout << b[linie][coloana] << " ";
  57. }
  58. }
  59. return 0;
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement