SHARE
TWEET

test

a guest Feb 18th, 2020 132 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <stdint.h>
  4. #include <inttypes.h>
  5. #include <time.h>
  6. #include <string.h>
  7. #include <wctype.h>
  8. #include <wchar.h>
  9. #include <locale.h>
  10. #include <math.h>
  11. #include <ctype.h>
  12.  
  13. double ***transpose(double ***arr) {
  14.    
  15. }
  16.  
  17. int main() {
  18.     int n;
  19.     scanf("%d", &n);
  20.     double ***arr = calloc(n + 1, sizeof(double));
  21.     arr[n] = NULL;
  22.     for (int i = 0; i < n; i++) {
  23.         int m;
  24.         scanf("%d", &m);
  25.         arr[i] = calloc(m + 1, sizeof(double));
  26.         arr[i][m] = NULL;
  27.         for (int j = 0; j < m; j++) {
  28.             arr[i][j] = calloc(1, sizeof(double));
  29.             scanf("%lf", arr[i][j]);
  30.         }
  31.     }
  32.     printf("Orig\n");
  33.     for (int i = 0; arr[i]; i++) {
  34.         for (int j = 0; arr[i][j]; j++) {
  35.             printf("%.0lf ", *arr[i][j]);
  36.             fflush(stdout);
  37.         }
  38.         printf("\n");
  39.     }
  40.     printf("\n");
  41.     double ***res = transpose(arr);
  42.     printf("Res\n");
  43.     for (int i = 0; arr[i]; i++) {
  44.         for (int j = 0; arr[i][j]; j++) {
  45.             free(arr[i][j]);
  46.         }
  47.         free(arr[i]);
  48.     }
  49.     free(arr);
  50.     for (int i = 0; res[i]; i++) {
  51.         for (int j = 0; res[i][j]; j++) {
  52.             printf("%.0lf ", *res[i][j]);
  53.             free(res[i][j]);
  54.             fflush(stdout);
  55.         }
  56.         free(res[i]);
  57.         printf("\n");
  58.     }
  59.     free(res);
  60.     printf("\n");
  61.     return 0;
  62. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top