glass.pas added
[srcbox.git] / usaco / concom.cpp
blob40c80570201c0a084e077f39e0127167f4ceff6d
1 /*
2 ID: xiaozqh1
3 PROG: concom
4 LANG: C++
5 */
6 #include <iostream>
7 #include <fstream>
8 using namespace std;
9 int a[100][100];
10 bool test[100][100][100];
11 int main() {
12 ifstream fin ("concom.in");
13 ofstream fout ("concom.out");
14 int i,j,k,n,x,y,z;
15 fin>>n;
16 for (i=0;i<n;i++) { fin>>x>>y>>z; a[x-1][y-1]=z; }
17 for (z=0;z<10;z++) {
18 for (k=0;k<100;k++) {
19 for (i=0;i<100;i++) {
20 for (j=0;j<100;j++) {
21 if (a[i][k]>50 && i!=j && test[i][j][k]==false) { a[i][j]+=a[k][j]; test[i][j][k]=true; }
26 for (i=0;i<100;i++) {
27 for (j=0;j<100;j++) {
28 if (a[i][j]>50 && i!=j) { fout<<i+1<<' '<<j+1<<endl; }
31 return 0;