Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int n, m, a[100][100], i, j, k;
- void init()
- {
- for(i = 1; i <= n; i++)
- for(j = 1; j <= n; j++)
- a[i][j] = INT_MAX;
- }
- int main()
- {
- int c;
- cin >> n;
- if(n > 100)
- cout << "ERONAT";
- else if(n <= 0)
- cout << "SI MAI ERONAT";
- else
- while(f >> i >> j >> c)
- {
- if(i <= 0 || i > n || j <= 0 || j > n)
- {
- g << "ERONAT";
- }
- a[i][j] = a[j][i] = c;
- }
- }
- void ROY()
- {
- for(k = 1; k <= n; k++)
- for(i = 1; i <= n; i++)
- for(j = 1; j <= n; j++)
- if(i != j && i != k && j != k && a[i][k] && a[k][j])
- if(a[i][j] == 0 || a[i][j] > a[i][k] + a[k][j])
- a[i][j] = a[i][k] + a[k][j];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement