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_20612728_31235.cpp:5:25: error: stray '#' in program
     using namespace std;#define maxn 18int dp[maxn][1<<18];int N, M, s, v;int main(){    while(scanf("%d", &N) && N){        scanf("%d", &M);        memset(dp, 0, sizeof(dp));        for(int i = 1; i <= M; i++){            scanf("%d%d", &s, &v);            dp[0][s] = v;        }        for(int i = 1; i <= N; i++){            for(int sta = 0; sta < (1<<N); sta++ ){                if(sta & 1<<(i-1)) dp[i][sta] = dp[i-1][sta] + dp[i-1][sta-(1<<(i-1))];                else dp[i][sta] = dp[i-1][sta];            }        }        int max = -9999;        for(int sta = 0; sta < (1<<N); sta++){            if(dp[N][sta] > max) max = dp[N][sta];        }        printf("%d\n", max);     }         return 0;}
                         ^
0_0_20612728_31235.cpp:5:26: error: 'define' does not name a type
     using namespace std;#define maxn 18int dp[maxn][1<<18];int N, M, s, v;int main(){    while(scanf("%d", &N) && N){        scanf("%d", &M);        memset(dp, 0, sizeof(dp));        for(int i = 1; i <= M; i++){            scanf("%d%d", &s, &v);            dp[0][s] = v;        }        for(int i = 1; i <= N; i++){            for(int sta = 0; sta < (1<<N); sta++ ){                if(sta & 1<<(i-1)) dp[i][sta] = dp[i-1][sta] + dp[i-1][sta-(1<<(i-1))];                else dp[i][sta] = dp[i-1][sta];            }        }        int max = -9999;        for(int sta = 0; sta < (1<<N); sta++){            if(dp[N][sta] > max) max = dp[N][sta];        }        printf("%d\n", max);     }         return 0;}
                          ^
0_0_20612728_31235.cpp: In function 'int main()':
0_0_20612728_31235.cpp:5:157: error: 'dp' was not declared in this scope
     using namespace std;#define maxn 18int dp[maxn][1<<18];int N, M, s, v;int main(){    while(scanf("%d", &N) && N){        scanf("%d", &M);        memset(dp, 0, sizeof(dp));        for(int i = 1; i <= M; i++){            scanf("%d%d", &s, &v);            dp[0][s] = v;        }        for(int i = 1; i <= N; i++){            for(int sta = 0; sta < (1<<N); sta++ ){                if(sta & 1<<(i-1)) dp[i][sta] = dp[i-1][sta] + dp[i-1][sta-(1<<(i-1))];                else dp[i][sta] = dp[i-1][sta];            }        }        int max = -9999;        for(int sta = 0; sta < (1<<N); sta++){            if(dp[N][sta] > max) max = dp[N][sta];        }        printf("%d\n", max);     }         return 0;}
                                                                                                                                                             ^


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-11-23 02:05:36, Gzip enabled