/* >>~~ UVa Online Judge ACM Problem Solution ~~<< ID: 10000 Name: Longest Paths Problem: https://onlinejudge.org/external/100/10000.pdf Language: C++ Author: Arash Shakery Email: arash.shakery@gmail.com */ #include #include using namespace std; int main(){ int cse = 1; int n, s, ev[110*110], ew[110*110], d[100]; while (cin>>n && n) { cin>>s; int en; for (en=0; cin>>ev[en]>>ew[en]; en++) if (!ev[en] || !ew[en]) break; for (int i=0; i<=n; i++) d[i] = 1000000; d[s] = 0; for (int i=0; i