DMG

Jesenji sampionat

DMG
Mar 29th, 2012
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.11 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. main()
  4. {
  5.       int a[50][50], n, i, j, s, p, b[50], t, c[i], d[i];
  6.       cin >> n;
  7.       for (i=0; i<n; i++)
  8.       for (j=0; j<n; j++)
  9.       {
  10.           if (i == j)
  11.           a[i][j] =  8;
  12.           if (j > i)
  13.           cin >> a[i][j];
  14.           if (a[i][j] == 2)
  15.           a[j][i] = 0;
  16.           if (a[i][j] == 1)
  17.           a[j][i] = 1;
  18.           if (a[i][j] == 0)
  19.           a[j][i] = 2;
  20.       }
  21.       for (i=0; i<n; i++)
  22.       {
  23.       for (j=0; j<n; j++)
  24.       cout << a[i][j] << " ";
  25.       cout << endl;
  26.       }
  27.       s = 0;
  28.       p = 0;
  29.       t = 0;
  30.       for (i=0; i<n; i++)
  31.       {
  32.       b[i] = 0;
  33.       c[i] = 0;
  34.       d[i] = 0;
  35.       for (j=0; j<n; j++)
  36.       {
  37.       if (a[i][j] != 0)
  38.       b[i] = b[i] + 1;
  39.       if (a[i][j] == 2)
  40.       c[i] = c[i] + 1;
  41.       if (a[i][j] == 0)
  42.       d[i] = d[i] + 1;
  43.       }
  44.       if (c[i] > d[i])
  45.       t = t + 1;
  46.       if (b[i]==n)
  47.       p = p + 1;
  48.       }
  49.      
  50.       cout << "Broj ekipa bez poraza: " << p << endl;
  51.       cout << "Broj ekipa sa vise pobjeda: " << t << endl;
  52.       system("PAUSE");
  53. }
Advertisement
Add Comment
Please, Sign In to add comment