Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- #define ll long long int
- int brick[10][10];
- void calc(int rx, int ry){
- int top = brick[rx][ry];
- int left = brick[rx + 2][ry];
- int right = brick[rx + 2][ry + 2];
- int mid = (top - left - right)/2;
- brick[rx + 2][ry + 1] = mid;
- brick[rx + 1][ry] = left + mid;
- brick[rx + 1][ry + 1] = right + mid;
- }
- int main(){
- #ifdef ERFANUL007
- clock_t tStart = clock();
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- #endif
- int t;
- cin >> t;
- while(t--){
- for(int i=1; i<=9; i+=2){
- for(int j=1; j<=i; j+=2){
- cin >> brick[i][j];
- }
- }
- for(int i=1; i<9; i+=2){
- for(int j=1; j<=i; j+=2){
- calc(i, j);
- }
- }
- for(int i=1; i<=9; i++){
- for(int j=1; j<=i; j++){
- if(j > 1) cout << ' ';
- cout << brick[i][j];
- }
- cout << '\n';
- }
- }
- #ifdef ERFANUL007
- fprintf(stderr, ">>> Runtime : %.9f\n", (double)(clock() - tStart)/CLOCKS_PER_SEC);
- #endif
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement