Skip to content

Instantly share code, notes, and snippets.

@ileasile
Created April 11, 2017 17:25
Show Gist options
  • Save ileasile/d3ad80111ab7393cc286721da451d398 to your computer and use it in GitHub Desktop.
Save ileasile/d3ad80111ab7393cc286721da451d398 to your computer and use it in GitHub Desktop.
Nick4343
unsigned int findBestWay() {
unsigned int be4last = N;
for(int i=0; i < N; ++i)
bestWay[i].resize(N);
for (unsigned int i = 0; i < N; i++) {
for (unsigned int k = 0; k < N; k++)
for (unsigned int j = 0; j < N; j++) {
int res = G[ans[i]][ans[k]] * G[ans[k]][ans[j]] / 10000;
if (G[ans[i]][ans[j]] < res) {
G[ans[i]][ans[j]] = res;
bestWay[ans[i]][ans[j]] = ans[k];
}
}
}
return be4last;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment