F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

View Compilation Error

0_0_31966082_32654.cpp:1:2: error: stray '#' in program
 ​#include<iostream>#include<cstdio>#include<algorithm>#include<cstring>#include<string>using namespace std; const int MAXN = 110;int tot, head[MAXN], n, m, dp[MAXN][MAXN], bugs[MAXN], val[MAXN]; struct Edge{ int to,next;}edge[MAXN << 1]; void init(){    memset(head, -1, sizeof(head));    tot = 0;}void addedge(int u,int v){ tot++;    edge[tot].to = v;    edge[tot].next = head[u];    head[u] = tot;} void dfs(int node, int fa){    int temp = (bugs[node] + 19) / 20;    for(int i = temp; i <= m; i++) {  dp[node][i] = val[node]; }     for (int i = head[node]; i > 0; i = edge[i].next)    {  int peer = edge[i].to;  if (peer != fa)  {   dfs(peer, node);            for (int j = m; j >= temp; j--)            {    for (int k = 1; k <= j - temp; k++)                {     dp[node][j] = max(dp[node][j], dp[node][j - k] + dp[peer][k]);                }            }        } }} int main(){    while (scanf("%d%d", &n, &m) != EOF && (n + m) != -2)    {        init();        memset(dp, 0, sizeof(dp));        for (int i = 1; i <= n; i++)  {   scanf("%d%d", &bugs[i], &val[i]);  }         for (int i = 1; i < n; i++)        {   int u,v;            scanf("%d%d", &u, &v);            addedge(u, v);            addedge(v, u);        }          dfs(1, -1);        if (m == 0)        {            printf("0\n");            continue;        }          printf("%d\n", dp[1][m]);    }     return 0;}
  ^
0_0_31966082_32654.cpp:1:8: error: stray '#' in program
 ​#include<iostream>#include<cstdio>#include<algorithm>#include<cstring>#include<string>using namespace std; const int MAXN = 110;int tot, head[MAXN], n, m, dp[MAXN][MAXN], bugs[MAXN], val[MAXN]; struct Edge{ int to,next;}edge[MAXN << 1]; void init(){    memset(head, -1, sizeof(head));    tot = 0;}void addedge(int u,int v){ tot++;    edge[tot].to = v;    edge[tot].next = head[u];    head[u] = tot;} void dfs(int node, int fa){    int temp = (bugs[node] + 19) / 20;    for(int i = temp; i <= m; i++) {  dp[node][i] = val[node]; }     for (int i = head[node]; i > 0; i = edge[i].next)    {  int peer = edge[i].to;  if (peer != fa)  {   dfs(peer, node);            for (int j = m; j >= temp; j--)            {    for (int k = 1; k <= j - temp; k++)                {     dp[node][j] = max(dp[node][j], dp[node][j - k] + dp[peer][k]);                }            }        } }} int main(){    while (scanf("%d%d", &n, &m) != EOF && (n + m) != -2)    {        init();        memset(dp, 0, sizeof(dp));        for (int i = 1; i <= n; i++)  {   scanf("%d%d", &bugs[i], &val[i]);  }         for (int i = 1; i < n; i++)        {   int u,v;            scanf("%d%d", &u, &v);            addedge(u, v);            addedge(v, u);        }          dfs(1, -1);        if (m == 0)        {            printf("0\n");            continue;        }          printf("%d\n", dp[1][m]);    }     return 0;}
        ^
0_0_31966082_32654.cpp:1:26: error: stray '#' in program
 ​#include<iostream>#include<cstdio>#include<algorithm>#include<cstring>#include<string>using namespace std; const int MAXN = 110;int tot, head[MAXN], n, m, dp[MAXN][MAXN], bugs[MAXN], val[MAXN]; struct Edge{ int to,next;}edge[MAXN << 1]; void init(){    memset(head, -1, sizeof(head));    tot = 0;}void addedge(int u,int v){ tot++;    edge[tot].to = v;    edge[tot].next = head[u];    head[u] = tot;} void dfs(int node, int fa){    int temp = (bugs[node] + 19) / 20;    for(int i = temp; i <= m; i++) {  dp[node][i] = val[node]; }     for (int i = head[node]; i > 0; i = edge[i].next)    {  int peer = edge[i].to;  if (peer != fa)  {   dfs(peer, node);            for (int j = m; j >= temp; j--)            {    for (int k = 1; k <= j - temp; k++)                {     dp[node][j] = max(dp[node][j], dp[node][j - k] + dp[peer][k]);                }            }        } }} int main(){    while (scanf("%d%d", &n, &m) != EOF && (n + m) != -2)    {        init();        memset(dp, 0, sizeof(dp));        for (int i = 1; i <= n; i++)  {   scanf("%d%d", &bugs[i], &val[i]);  }         for (int i = 1; i < n; i++)        {   int u,v;            scanf("%d%d", &u, &v);            addedge(u, v);            addedge(v, u);        }          dfs(1, -1);        if (m == 0)        {            printf("0\n");            continue;        }          printf("%d\n", dp[1][m]);    }     return 0;}
                          ^
0_0_31966082_32654.cpp:1:42: error: stray '#' in program
 ​#include<iostream>#include<cstdio>#include<algorithm>#include<cstring>#include<string>using namespace std; const int MAXN = 110;int tot, head[MAXN], n, m, dp[MAXN][MAXN], bugs[MAXN], val[MAXN]; struct Edge{ int to,next;}edge[MAXN << 1]; void init(){    memset(head, -1, sizeof(head));    tot = 0;}void addedge(int u,int v){ tot++;    edge[tot].to = v;    edge[tot].next = head[u];    head[u] = tot;} void dfs(int node, int fa){    int temp = (bugs[node] + 19) / 20;    for(int i = temp; i <= m; i++) {  dp[node][i] = val[node]; }     for (int i = head[node]; i > 0; i = edge[i].next)    {  int peer = edge[i].to;  if (peer != fa)  {   dfs(peer, node);            for (int j = m; j >= temp; j--)            {    for (int k = 1; k <= j - temp; k++)                {     dp[node][j] = max(dp[node][j], dp[node][j - k] + dp[peer][k]);                }            }        } }} int main(){    while (scanf("%d%d", &n, &m) != EOF && (n + m) != -2)    {        init();        memset(dp, 0, sizeof(dp));        for (int i = 1; i <= n; i++)  {   scanf("%d%d", &bugs[i], &val[i]);  }         for (int i = 1; i < n; i++)        {   int u,v;            scanf("%d%d", &u, &v);            addedge(u, v);            addedge(v, u);        }          dfs(1, -1);        if (m == 0)        {            printf("0\n");            continue;        }          printf("%d\n", dp[1][m]);    }     return 0;}
                                          ^
0_0_31966082_32654.cpp:1:61: error: stray '#' in program
 ​#include<iostream>#include<cstdio>#include<algorithm>#include<cstring>#include<string>using namespace std; const int MAXN = 110;int tot, head[MAXN], n, m, dp[MAXN][MAXN], bugs[MAXN], val[MAXN]; struct Edge{ int to,next;}edge[MAXN << 1]; void init(){    memset(head, -1, sizeof(head));    tot = 0;}void addedge(int u,int v){ tot++;    edge[tot].to = v;    edge[tot].next = head[u];    head[u] = tot;} void dfs(int node, int fa){    int temp = (bugs[node] + 19) / 20;    for(int i = temp; i <= m; i++) {  dp[node][i] = val[node]; }     for (int i = head[node]; i > 0; i = edge[i].next)    {  int peer = edge[i].to;  if (peer != fa)  {   dfs(peer, node);            for (int j = m; j >= temp; j--)            {    for (int k = 1; k <= j - temp; k++)                {     dp[node][j] = max(dp[node][j], dp[node][j - k] + dp[peer][k]);                }            }        } }} int main(){    while (scanf("%d%d", &n, &m) != EOF && (n + m) != -2)    {        init();        memset(dp, 0, sizeof(dp));        for (int i = 1; i <= n; i++)  {   scanf("%d%d", &bugs[i], &val[i]);  }         for (int i = 1; i < n; i++)        {   int u,v;            scanf("%d%d", &u, &v);            addedge(u, v);            addedge(v, u);        }          dfs(1, -1);        if (m == 0)        {            printf("0\n");            continue;        }          printf("%d\n", dp[1][m]);    }     return 0;}
                                                             ^
0_0_31966082_32654.cpp:1:78: error: stray '#' in program
 ​#include<iostream>#include<cstdio>#include<algorithm>#include<cstring>#include<string>using namespace std; const int MAXN = 110;int tot, head[MAXN], n, m, dp[MAXN][MAXN], bugs[MAXN], val[MAXN]; struct Edge{ int to,next;}edge[MAXN << 1]; void init(){    memset(head, -1, sizeof(head));    tot = 0;}void addedge(int u,int v){ tot++;    edge[tot].to = v;    edge[tot].next = head[u];    head[u] = tot;} void dfs(int node, int fa){    int temp = (bugs[node] + 19) / 20;    for(int i = temp; i <= m; i++) {  dp[node][i] = val[node]; }     for (int i = head[node]; i > 0; i = edge[i].next)    {  int peer = edge[i].to;  if (peer != fa)  {   dfs(peer, node);            for (int j = m; j >= temp; j--)            {    for (int k = 1; k <= j - temp; k++)                {     dp[node][j] = max(dp[node][j], dp[node][j - k] + dp[peer][k]);                }            }        } }} int main(){    while (scanf("%d%d", &n, &m) != EOF && (n + m) != -2)    {        init();        memset(dp, 0, sizeof(dp));        for (int i = 1; i <= n; i++)  {   scanf("%d%d", &bugs[i], &val[i]);  }         for (int i = 1; i < n; i++)        {   int u,v;            scanf("%d%d", &u, &v);            addedge(u, v);            addedge(v, u);        }          dfs(1, -1);        if (m == 0)        {            printf("0\n");            continue;        }          printf("%d\n", dp[1][m]);    }     return 0;}
                                                                              ^
0_0_31966082_32654.cpp:1:3: error: expected unqualified-id before numeric constant
 ​#include<iostream>#include<cstdio>#include<algorithm>#include<cstring>#include<string>using namespace std; const int MAXN = 110;int tot, head[MAXN], n, m, dp[MAXN][MAXN], bugs[MAXN], val[MAXN]; struct Edge{ int to,next;}edge[MAXN << 1]; void init(){    memset(head, -1, sizeof(head));    tot = 0;}void addedge(int u,int v){ tot++;    edge[tot].to = v;    edge[tot].next = head[u];    head[u] = tot;} void dfs(int node, int fa){    int temp = (bugs[node] + 19) / 20;    for(int i = temp; i <= m; i++) {  dp[node][i] = val[node]; }     for (int i = head[node]; i > 0; i = edge[i].next)    {  int peer = edge[i].to;  if (peer != fa)  {   dfs(peer, node);            for (int j = m; j >= temp; j--)            {    for (int k = 1; k <= j - temp; k++)                {     dp[node][j] = max(dp[node][j], dp[node][j - k] + dp[peer][k]);                }            }        } }} int main(){    while (scanf("%d%d", &n, &m) != EOF && (n + m) != -2)    {        init();        memset(dp, 0, sizeof(dp));        for (int i = 1; i <= n; i++)  {   scanf("%d%d", &bugs[i], &val[i]);  }         for (int i = 1; i < n; i++)        {   int u,v;            scanf(


Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-12-02 06:34:52, Gzip enabled