0_0_20612928_12098.cpp:5:25: error: stray '#' in program
using namespace std;#define N 2005#define INF 0x7fffffffint dp[N];int tmp=0;int e, ne[N], v[N], w[N],adj[N];void add(int x, int y, int z){ v[e] = y, w[e] = z; ne[e] = adj[x], adj[x] = e ++;}void dfs(int cur, int fa){ int i, flag = 0; dp[cur] = 0; for(i = adj[cur]; i != -1; i = ne[i]) if(v[i] != fa) { flag = 1; dfs(v[i], cur); dp[cur] += min(w[i], dp[v[i]]); } if(flag == 0) dp[cur] = INF;}int main(){ int n,r,a,b,c; while(scanf("%d%d",&n,&r)!=EOF) { if(n==0 && r==0) break; memset(adj,-1,sizeof(adj)); for(int i=1; i<n; i++) { scanf("%d%d%d",&a,&b,&c); add(a,b,c); add(b,a,c); } for(int i=0; i<=n; i++) dp[i]=INF; if(n==1) printf("0\n"); else { e=0; dfs(r,-1); printf("%d\n",dp[r]); } } return 0;}
^
0_0_20612928_12098.cpp:5:39: error: stray '#' in program
using namespace std;#define N 2005#define INF 0x7fffffffint dp[N];int tmp=0;int e, ne[N], v[N], w[N],adj[N];void add(int x, int y, int z){ v[e] = y, w[e] = z; ne[e] = adj[x], adj[x] = e ++;}void dfs(int cur, int fa){ int i, flag = 0; dp[cur] = 0; for(i = adj[cur]; i != -1; i = ne[i]) if(v[i] != fa) { flag = 1; dfs(v[i], cur); dp[cur] += min(w[i], dp[v[i]]); } if(flag == 0) dp[cur] = INF;}int main(){ int n,r,a,b,c; while(scanf("%d%d",&n,&r)!=EOF) { if(n==0 && r==0) break; memset(adj,-1,sizeof(adj)); for(int i=1; i<n; i++) { scanf("%d%d%d",&a,&b,&c); add(a,b,c); add(b,a,c); } for(int i=0; i<=n; i++) dp[i]=INF; if(n==1) printf("0\n"); else { e=0; dfs(r,-1); printf("%d\n",dp[r]); } } return 0;}
^
0_0_20612928_12098.cpp:5:26: error: 'define' does not name a type
using namespace std;#define N 2005#define INF 0x7fffffffint dp[N];int tmp=0;int e, ne[N], v[N], w[N],adj[N];void add(int x, int y, int z){ v[e] = y, w[e] = z; ne[e] = adj[x], adj[x] = e ++;}void dfs(int cur, int fa){ int i, flag = 0; dp[cur] = 0; for(i = adj[cur]; i != -1; i = ne[i]) if(v[i] != fa) { flag = 1; dfs(v[i], cur); dp[cur] += min(w[i], dp[v[i]]); } if(flag == 0) dp[cur] = INF;}int main(){ int n,r,a,b,c; while(scanf("%d%d",&n,&r)!=EOF) { if(n==0 && r==0) break; memset(adj,-1,sizeof(adj)); for(int i=1; i<n; i++) { scanf("%d%d%d",&a,&b,&c); add(a,b,c); add(b,a,c); } for(int i=0; i<=n; i++) dp[i]=INF; if(n==1) printf("0\n"); else { e=0; dfs(r,-1); printf("%d\n",dp[r]); } } return 0;}
^
0_0_20612928_12098.cpp:5:92: error: 'N' was not declared in this scope
using namespace std;#define N 2005#define INF 0x7fffffffint dp[N];int tmp=0;int e, ne[N], v[N], w[N],adj[N];void add(int x, int y, int z){ v[e] = y, w[e] = z; ne[e] = adj[x], adj[x] = e ++;}void dfs(int cur, int fa){ int i, flag = 0; dp[cur] = 0; for(i = adj[cur]; i != -1; i = ne[i]) if(v[i] != fa) { flag = 1; dfs(v[i], cur); dp[cur] += min(w[i], dp[v[i]]); } if(flag == 0) dp[cur] = INF;}int main(){ int n,r,a,b,c; while(scanf("%d%d",&n,&r)!=EOF) { if(n==0 && r==0) break; memset(adj,-1,sizeof(adj)); for(int i=1; i<n; i++) { scanf("%d%d%d",&a,&b,&c); add(a,b,c); add(b,a,c); } for(int i=0; i<=n; i++) dp[i]=INF; if(n==1) printf("0\n"); else { e=0; dfs(r,-1); printf("%d\n",dp[r]); } } return 0;}
^
0_0_20612928_12098.cpp:5:98: error: 'N' was not declared in this scope
using namespace std;#define N 2005#define INF 0x7fffffffint dp[N];int tmp=0;int e, ne[N], v[N], w[N],adj[N];void add(int x, int y, int z){ v[e] = y, w[e] = z; ne[e] = adj[x], adj[x] = e ++;}void dfs(int cur, int fa){ int i, flag = 0; dp[cur] = 0; for(i = adj[cur]; i != -1; i = ne[i]) if(v[i] != fa) { flag = 1; dfs(v[i], cur); dp[cur] += min(w[i], dp[v[i]]); } if(flag == 0) dp[cur] = INF;}int main(){ int n,r,a,b,c; while(scanf("%d%d",&n,&r)!=EOF) { if(n==0 && r==0) break; memset(adj,-1,sizeof(adj)); for(int i=1; i<n; i++) { scanf("%d%d%d",&a,&b,&c); add(a,b,c); add(b,a,c); } for(int i=0; i<=n; i++) dp[i]=INF; if(n==1) printf("0\n"); else { e=0; dfs(r,-1); printf("%d\n",dp[r]); } } return 0;}
^
0_0_20612928_12098.cpp:5:104: error: 'N' was not declared in this scope
using namespace std;#define N 2005#define INF 0x7fffffffint dp[N];int tmp=0;int e, ne[N], v[N], w[N],adj[N];void add(int x, int y, int z){ v[e] = y, w[e] = z; ne[e] = adj[x], adj[x] = e ++;}void dfs(int cur, int fa){ int i, flag = 0; dp[cur] = 0; for(i = adj[cur]; i != -1; i = ne[i]) if(v[i] != fa) { flag = 1; dfs(v[i], cur); dp[cur] += min(w[i], dp[v[i]]); } if(flag == 0) dp[cur] = INF;}int main(){ int n,r,a,b,c; while(scanf("%d%d",&n,&r)!=EOF) { if(n==0 && r==0) break; memset(adj,-1,sizeof(adj)); for(int i=1; i<n; i++) { scanf("%d%d%d",&a,&b,&c); add(a,b,c); add(b,a,c); } for(int i=0; i<=n; i++) dp[i]=INF; if(n==1) printf("0\n"); else { e=0; dfs(r,-1); printf("%d\n",dp[r]); } } return 0;}
^
0_0_20612928_12098.cpp:5:111: error: 'N' was not declared in this scope
using namespace std;#define N 2005#define INF 0x7fffffffint dp[N];int tmp=0;int e, ne[N], v[N], w[N],adj[N];void add(int x, int y, int z){ v[e] = y, w[e] = z; ne[e] = adj[x], adj[x] = e ++;}void dfs(int cur, int fa){ int i, flag = 0; dp[cur] = 0; for(i = adj[cur]; i != -1; i = ne[i]) if(v[i] != fa) { flag = 1; dfs(v[i], cur); dp[cur] += min(w[i], dp[v[i]]); } if(flag == 0) dp[cur] = INF;}int main(){ int n,r,a,b,c; while(scanf("%d%d",&n,&r)!=EOF) { if(n==0 && r==0) break; memset(adj,-1,sizeof(adj)); for(int i=1; i<n; i++) { scanf("%d%d%d",&a,&b,&c); add(a,b,c); add(b,a,c); } for(int i=0; i<=n; i++) dp[i]=INF; if(n==1) printf("0\n"); else { e=0; dfs(r,-1); printf("%d\n",dp[r]); } } return 0;}
^
0_0_20612928_12098.cpp: In function 'void add(int, int, int)':
0_0_20612928_12098.cpp:5:148: error: 'v' was not declared in this scope
using namespace std;#define N 2005#define INF 0x7fffffffint dp[N];int tmp=0;int e, ne[N], v[N], w[N],adj[N];void add(int x, int y, int z){ v[e] = y, w[e] = z; ne[e] = adj[x], adj[x] = e ++;}void dfs(int cur, int fa){ int i, flag = 0; dp[cur] = 0; for(i = adj[cur]; i != -1; i = ne[i]) if(v[i] != fa) { flag = 1; dfs(v[i], cur); dp[cur] += min(w[i], dp[v[i]]); } if(flag == 0) dp[cur] = INF;}int main(){ int n,r,a,b,c; while(scanf("%d%d",&n,&r)!=EOF) { if(n==0 && r==0) break; memset(adj,-1,sizeof(adj)); for(int i=1; i<n; i++) { scanf("%d%d%d",&a,&b,&c); add(a,b,c); add(b,a,c); } for(int i=0; i<=n; i++) dp[i]=INF; if(n==1) printf("0\n"); else { e=0; dfs(r,-1); printf("%d\n",dp[r]); } } return 0;}
^
0_0_20612928_12098.cpp:5:158: error: 'w' was not declared in this scope
using namespace std;#define N 2005#define INF 0x7fffffffint dp[N];int tmp=0;int e, ne[N], v[N], w[N],adj[N];void add(int x, int y, int z){ v[e] = y, w[e] = z; ne[e] = adj[x], adj[x] = e ++;}void dfs(int cur, int fa){ int i, flag = 0; dp[cur] = 0; for(i = adj[cur]; i != -1; i = ne[i]) if(v[i] != fa) { flag = 1; dfs(v[i], cur); dp[cur] += min(w[i], dp[v[i]]); } if(flag == 0) dp[cur] = INF;}int main(){ int n,r,a,b,c; while(scanf("%d%d",&n,&r)!=EOF) { if(n==0 && r==0) break; memset(adj,-1,sizeof(adj)); for(int i=1; i<n; i++) { scanf("%d%d%d",&a,&b,&c); add(a,b,c); add(b,a,c); } for(int i=0; i<=n; i++) dp[i]=INF; if(n==1) printf("0\n"); else { e=0; dfs(r,-1); printf("%d\n",dp[r]); } } return 0;}
|