Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "pch.h"
- #include <iostream>
- #include <cmath>
- #include <string>
- #include <iomanip>
- #include <regex>
- #include <cstdlib>
- using namespace std;
- int main() {
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- int n; cin >> n;
- int a; double b; cin >> a >> b; cout << a << " " << b;
- double **w = new double*[n];
- double **pher = new double*[n];
- int *visited = new int[n];
- int ants[10];
- for (int i = 0; i < n; i++) {
- w[i] = new double[n];
- pher[i] = new double[n];
- visited[i] = 0;
- for (int j = 0; j < n; j++) {
- cin >> w[i][j];
- pher[i][j] = 1;
- }
- }
- double
- alpha = 1,
- beta = 1,
- best_path = 100000000;
- for (int q = 0; q < 10; q++) {
- // int i = rand() % n;
- int i = 0;
- visited[i] = 1;
- double *Ps = new double[n];
- for (int k = 0; k < n; k++)
- Ps[k] = 0;
- for (int m = 0; m < 10; m++) {
- double znam = 0;
- for (int j = 0; j < n; j++) {
- if (j != i && w[i][j] != 0) {
- znam += pher[i][j] / w[i][j];
- }
- }
- for (int j = 0; j < n; j++) {
- if (j != i && w[i][j] != 0) {
- Ps[j] = (pher[i][j] * 1 / w[i][j]) / znam;
- cout << "1 -> " << j + 1 << ": " << Ps[j] << endl;
- }
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement