Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- main()
- {
- int a[50][50], n, i, j, s, p, b[50], t, c[i], d[i];
- cin >> n;
- for (i=0; i<n; i++)
- for (j=0; j<n; j++)
- {
- if (i == j)
- a[i][j] = 8;
- if (j > i)
- cin >> a[i][j];
- if (a[i][j] == 2)
- a[j][i] = 0;
- if (a[i][j] == 1)
- a[j][i] = 1;
- if (a[i][j] == 0)
- a[j][i] = 2;
- }
- for (i=0; i<n; i++)
- {
- for (j=0; j<n; j++)
- cout << a[i][j] << " ";
- cout << endl;
- }
- s = 0;
- p = 0;
- t = 0;
- for (i=0; i<n; i++)
- {
- b[i] = 0;
- c[i] = 0;
- d[i] = 0;
- for (j=0; j<n; j++)
- {
- if (a[i][j] != 0)
- b[i] = b[i] + 1;
- if (a[i][j] == 2)
- c[i] = c[i] + 1;
- if (a[i][j] == 0)
- d[i] = d[i] + 1;
- }
- if (c[i] > d[i])
- t = t + 1;
- if (b[i]==n)
- p = p + 1;
- }
- cout << "Broj ekipa bez poraza: " << p << endl;
- cout << "Broj ekipa sa vise pobjeda: " << t << endl;
- system("PAUSE");
- }
Advertisement
Add Comment
Please, Sign In to add comment