#include // std #include // ifstream, ofstream #include // assert #include // RAND_MAX using namespace std; #define INF RAND_MAX int main() { int N; int M; int i,j,w; int path; //-------------------------------------------------------------------------- // input ifstream input("input.txt"); assert(input); input >> N >> M; int matrix[N][N]; for(i=0; i> i >> j >> w; matrix[i][j] = w; } input.close(); //-------------------------------------------------------------------------- int shortPath[2][N]; for(i=0; i0) // se il link esiste... { path = w+shortPath[0][i]; // ... calcolo il costo del path if(path0 && path == shortPath[0][j]) trees[j]++; } } int nTrees = 1; for(i=1; i