Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _USE_MATH_DEFINES
- #include <iostream>
- #include <string>
- #include <map>
- #include <set>
- #include <algorithm>
- #include <vector>
- #include <stdio.h>
- #include <cmath>
- #include <math.h>
- #include <queue>
- #include <stack>
- #include <climits>
- #include <deque>
- #include <ctime>
- using namespace std;
- typedef long long ll;
- typedef unsigned long long ull;
- typedef unsigned int ui;
- #define mh() make_heap()
- #define poph() pop_heap()
- #define pushh() push_heap()
- #define sor(n) n.begin(), n.end()
- #define mp make_pair
- #define files freopen("input.txt", "rt", stdin); freopen("output.txt", "wt", stdout)
- #define p(T) pair<T,T>
- #define znac(l) abs(l)/l
- const ll ok = ll(1e9 + 7);
- double cr[201][201];
- double uncr[201][201];
- double scr[201][201];
- int main()
- {
- //files;
- cout.precision(10);
- cout.setf(ios::fixed);
- ll n;
- cin >> n;
- for(int x=1;x<=n;x++)
- for (int i = 1; i <= n; i++)
- {
- cin >> scr[x][i];
- }
- for (int x = 1; x <= n; x++)
- for (int y = 1; y <= n; y++)
- {
- if (x != y)
- {
- if (scr[y][x] < scr[x][y])
- {
- double prom = scr[y][x];
- double mab = (scr[x][y] - prom) / 2.0;
- uncr[y][x] = (-1.0)*mab;
- cr[y][x] = mab + prom;
- uncr[x][y] = mab;
- cr[x][y] = mab + prom;
- }
- else
- if (scr[y][x] > scr[x][y])
- {
- double prom = scr[x][y];
- double mab = (scr[y][x] - prom) / 2.0;
- uncr[x][y] = (-1)*mab;
- cr[x][y] = mab + prom;
- uncr[y][x] = mab;
- cr[y][x] = mab + prom;
- }
- else
- {
- uncr[x][y] = 0;
- cr[x][y] = scr[x][y];
- uncr[y][x] = 0;
- cr[y][x] = scr[x][y];
- }
- }
- else
- {
- cr[x][y] = scr[x][y];
- uncr[x][y] = 0;
- }
- }
- cout << "YES" << endl;
- for (int i = 1; i <= n; i++)
- {
- for (int j = 1; j <= n; j++)
- {
- cout << cr[i][j] << " ";
- }
- cout << endl;
- }
- cout << endl;
- for (int i = 1; i <= n; i++)
- {
- for (int j = 1; j <= n; j++)
- {
- cout << uncr[i][j] << " ";
- }
- if (i != n)
- cout << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment