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_20613092_8394.cpp:12:6: error: 'z' does not name a type
      z){            if(!flag) v.val -= z;            return v;        }        else{            if(v.index) flag = 1;            z -= v.val;            v.val = life[++v.index];            if(v.index > 1 && z == 0) return v;        }    }    return v;} int main(){    while(scanf("%d %d %d", &n, &m, &k) != EOF){        if(n + m + k ==0) break;        for(int i = 1; i <= n; ++i)            scanf("%d", &fb[i]);        for(int i = 1; i <= k; ++i)            scanf("%d", &life[i]);        if(!k){            printf("0\n");            continue;        }        MAX = 0;        dp[0][0].index = 0, dp[0][0].val = 0;        for(int i = 1; i <= n; ++i){            int p = min(i, m);            for(int j = 0; j <= p; ++j){                node x = cal(i, j, 0);                if(!j){                    dp[i][j] = x;                    MAX = max(MAX, dp[i][j].index - 1);                    continue;                }                node y = cal(i, j, 1);                if(j == i){                    dp[i][j] = y;                    MAX = max(MAX, dp[i][j].index - 1);                    continue;                }                if(x.index > y.index) dp[i][j] = x;                else if(x.index < y.index) dp[i][j] = y;                else if(x.val > y.val) dp[i][j] = y;                else dp[i][j] = x;                MAX = max(MAX, dp[i][j].index - 1);            }            if(p <= m) dp[i][p + 1] = dp[i][p];        }        printf("%d\n", MAX);    }    return 0;}
      ^
0_0_20613092_8394.cpp:12:80: error: expected unqualified-id before 'else'
      z){            if(!flag) v.val -= z;            return v;        }        else{            if(v.index) flag = 1;            z -= v.val;            v.val = life[++v.index];            if(v.index > 1 && z == 0) return v;        }    }    return v;} int main(){    while(scanf("%d %d %d", &n, &m, &k) != EOF){        if(n + m + k ==0) break;        for(int i = 1; i <= n; ++i)            scanf("%d", &fb[i]);        for(int i = 1; i <= k; ++i)            scanf("%d", &life[i]);        if(!k){            printf("0\n");            continue;        }        MAX = 0;        dp[0][0].index = 0, dp[0][0].val = 0;        for(int i = 1; i <= n; ++i){            int p = min(i, m);            for(int j = 0; j <= p; ++j){                node x = cal(i, j, 0);                if(!j){                    dp[i][j] = x;                    MAX = max(MAX, dp[i][j].index - 1);                    continue;                }                node y = cal(i, j, 1);                if(j == i){                    dp[i][j] = y;                    MAX = max(MAX, dp[i][j].index - 1);                    continue;                }                if(x.index > y.index) dp[i][j] = x;                else if(x.index < y.index) dp[i][j] = y;                else if(x.val > y.val) dp[i][j] = y;                else dp[i][j] = x;                MAX = max(MAX, dp[i][j].index - 1);            }            if(p <= m) dp[i][p + 1] = dp[i][p];        }        printf("%d\n", MAX);    }    return 0;}
                                                                                ^
0_0_20613092_8394.cpp:12:237: error: expected declaration before '}' token
      z){            if(!flag) v.val -= z;            return v;        }        else{            if(v.index) flag = 1;            z -= v.val;            v.val = life[++v.index];            if(v.index > 1 && z == 0) return v;        }    }    return v;} int main(){    while(scanf("%d %d %d", &n, &m, &k) != EOF){        if(n + m + k ==0) break;        for(int i = 1; i <= n; ++i)            scanf("%d", &fb[i]);        for(int i = 1; i <= k; ++i)            scanf("%d", &life[i]);        if(!k){            printf("0\n");            continue;        }        MAX = 0;        dp[0][0].index = 0, dp[0][0].val = 0;        for(int i = 1; i <= n; ++i){            int p = min(i, m);            for(int j = 0; j <= p; ++j){                node x = cal(i, j, 0);                if(!j){                    dp[i][j] = x;                    MAX = max(MAX, dp[i][j].index - 1);                    continue;                }                node y = cal(i, j, 1);                if(j == i){                    dp[i][j] = y;                    MAX = max(MAX, dp[i][j].index - 1);                    continue;                }                if(x.index > y.index) dp[i][j] = x;                else if(x.index < y.index) dp[i][j] = y;                else if(x.val > y.val) dp[i][j] = y;                else dp[i][j] = x;                MAX = max(MAX, dp[i][j].index - 1);            }            if(p <= m) dp[i][p + 1] = dp[i][p];        }        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-26 04:36:21, Gzip enabled