Advertisement
Guest User

Untitled

a guest
Oct 27th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.58 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include "stuff.h"
  4.  
  5. int main() {
  6.  
  7.     int matrices = 0;
  8.     fscanf(stdin, "%d", &matrices);
  9.  
  10.     int R=0, C=0;
  11.     fscanf(stdin, "%d %d", &R, &C);
  12.     double **result = mread(stdin, &R, &C);
  13.  
  14.     while(matrices>1) {
  15.         int nextR=0, nextC=0;
  16.         fscanf(stdin, "%d %d", &nextR, &nextC);
  17.         double **next = mread(stdin, &nextR, &nextC);
  18.  
  19.         result = mmult(R,C,result,nextR,nextC,next);
  20.         xfree(nextR,nextC,next);
  21.         C=nextC;
  22.  
  23.         matrices--;
  24.     }
  25.  
  26.     mwrite(stdout,R,C,result);
  27.     xfree(R,C,result);
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement