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_20613957_2791.cpp:11:5: error: expected unqualified-id before '=' token
     = p || a[idx - 1].len() >= p) {        a[idx ++] = Node (s , tot);    }    else {        a[idx - 1].cat ();        a[idx - 1].s += Node (s , tot).cat();    }} int match (string s , char *t , int p) {    int l = s.size() ;    int i = 0 , j = 0 , ans = 0;    while (i < s.size()) {        if (j == - 1 || s[i] == t[j]) {            i ++; j ++;            if (j == p) {                ans ++;                j = ne[j];            }        }        else j = ne[j];    }    return ans;} int main () {    while (scanf ("%s %s" , str , pat) != EOF) {        idx = 0;        l = strlen (str);p = strlen (pat);        get_next (pat , p);        string s = "";        int tot = 1;        for (int i = 0 ; i < l ; i ++) {            if (str[i] == '[') {                if (s == "") continue;                gao (s , tot);                s = ""; tot = 1;            }            else if (str[i] == ']') {                tot = 0;                i ++;                while (isdigit(str[i]))                    tot = tot * 10 + str[i ++] - '0';                i --;                gao (s , tot);                s = ""; tot = 1;            }            else s += str[i];        }        gao (s , tot);        s = ""; tot = 1;        LL ans = 0;        for (int i = 0 ; i < idx ; i ++) {            if (a[i].len() < p) continue;            if (a[i].cnt == 1) ans += match (a[i].s , pat , p);            else {                int use = min(a[i].cnt , 1 + (p - 1 + (int)a[i].s.size() - 1) / (int)a[i].s.size());                string s = "";                for (int j = 1 ; j < use ; j ++) {                    s += a[i].s;                }                s = a[i].s + s.substr (0 , min ((int)s.size() , p - 1));                int tmp = match (s , pat , p);                ans += (LL)tmp * (a[i].cnt - use + 1);                if (p) {                    s = "";                    for (int j = 1 ; j < use ; j ++)                        s += a[i].s;                    ans += match (s , pat , p);                }            }        }        for (int i = 0 ; i < idx - 1 ; i ++) {            s = a[i].suffix (min (a[i].len () , p - 1LL));            if (a[i + 1].len () < p - 1) {                s += a[i + 1].cat ();                if (i + 2 < idx) {                    s += a[i + 2].prefix (min (a[i + 2].len () , p - 1 - a[i + 2].len ()));                }            }            else {                s += a[i + 1].prefix (min (a[i + 1].len () , p - 1LL));            }            ans += match (s , pat , p);        }        printf ("%I64d\n" , ans);    }    return 0;}
     ^
0_0_20613957_2791.cpp:11:80: error: expected unqualified-id before 'else'
     = p || a[idx - 1].len() >= p) {        a[idx ++] = Node (s , tot);    }    else {        a[idx - 1].cat ();        a[idx - 1].s += Node (s , tot).cat();    }} int match (string s , char *t , int p) {    int l = s.size() ;    int i = 0 , j = 0 , ans = 0;    while (i < s.size()) {        if (j == - 1 || s[i] == t[j]) {            i ++; j ++;            if (j == p) {                ans ++;                j = ne[j];            }        }        else j = ne[j];    }    return ans;} int main () {    while (scanf ("%s %s" , str , pat) != EOF) {        idx = 0;        l = strlen (str);p = strlen (pat);        get_next (pat , p);        string s = "";        int tot = 1;        for (int i = 0 ; i < l ; i ++) {            if (str[i] == '[') {                if (s == "") continue;                gao (s , tot);                s = ""; tot = 1;            }            else if (str[i] == ']') {                tot = 0;                i ++;                while (isdigit(str[i]))                    tot = tot * 10 + str[i ++] - '0';                i --;                gao (s , tot);                s = ""; tot = 1;            }            else s += str[i];        }        gao (s , tot);        s = ""; tot = 1;        LL ans = 0;        for (int i = 0 ; i < idx ; i ++) {            if (a[i].len() < p) continue;            if (a[i].cnt == 1) ans += match (a[i].s , pat , p);            else {                int use = min(a[i].cnt , 1 + (p - 1 + (int)a[i].s.size() - 1) / (int)a[i].s.size());                string s = "";                for (int j = 1 ; j < use ; j ++) {                    s += a[i].s;                }                s = a[i].s + s.substr (0 , min ((int)s.size() , p - 1));                int tmp = match (s , pat , p);                ans += (LL)tmp * (a[i].cnt - use + 1);                if (p) {                    s = "";                    for (int j = 1 ; j < use ; j ++)                        s += a[i].s;                    ans += match (s , pat , p);                }            }        }        for (int i = 0 ; i < idx - 1 ; i ++) {            s = a[i].suffix (min (a[i].len () , p - 1LL));            if (a[i + 1].len () < p - 1) {                s += a[i + 1].cat ();                if (i + 2 < idx) {                    s += a[i + 2].prefix (min (a[i + 2].len () , p - 1 - a[i + 2].len ()));                }            }            else {                s += a[i + 1].prefix (min (a[i + 1].len () , p - 1LL));            }            ans += match (s , pat , p);        }        printf ("%I64d\n" , ans);    }    return 0;}
                                                                                ^
0_0_20613957_2791.cpp:11:162: error: expected declaration before '}' token
     = p || a[idx - 1].len() >= p) {        a[idx ++] = Node (s , tot);    }    else {        a[idx - 1].cat ();        a[idx - 1].s += Node (s , tot).cat();    }} int match (string s , char *t , int p) {    int l = s.size() ;    int i = 0 , j = 0 , ans = 0;    while (i < s.size()) {        if (j == - 1 || s[i] == t[j]) {            i ++; j ++;            if (j == p) {                ans ++;                j = ne[j];            }        }        else j = ne[j];    }    return ans;} int main () {    while (scanf ("%s %s" , str , pat) != EOF) {        idx = 0;        l = strlen (str);p = strlen (pat);        get_next (pat , p);        string s = "";        int tot = 1;        for (int i = 0 ; i < l ; i ++) {            if (str[i] == '[') {                if (s == "") continue;                gao (s , tot);                s = ""; tot = 1;            }            else if (str[i] == ']') {                tot = 0;                i ++;                while (isdigit(str[i]))                    tot = tot * 10 + str[i ++] - '0';                i --;                gao (s , tot);                s = ""; tot = 1;            }            else s += str[i];        }        gao (s , tot);        s = ""; tot = 1;        LL ans = 0;        for (int i = 0 ; i < idx ; i ++) {            if (a[i].len() < p) continue;            if (a[i].cnt == 1) ans += match (a[i].s , pat , p);            else {                int use = min(a[i].cnt , 1 + (p - 1 + (int)a[i].s.size() - 1) / (int)a[i].s.size());                string s = "";                for (int j = 1 ; j < use ; j ++) {                    s += a[i].s;                }                s = a[i].s + s.substr (0 , min ((int)s.size() , p - 1));                int tmp = match (s , pat , p);                ans += (LL)tmp * (a[i].cnt - use + 1);                if (p) {                    s = "";                    for (int j = 1 ; j < use ; j ++)                        s += a[i].s;                    ans += match (s , pat , p);                }            }        }        for (int i = 0 ; i < idx - 1 ; i ++) {            s = a[i].suffix (min (a[i].len () , p - 1LL));            if (a[i + 1].len () < p - 1) {                s += a[i + 1].cat ();                if (i + 2 < idx) {                    s += a[i + 2].prefix (min (a[i + 2].len () , p - 1 - a[i + 2].len ()));                }            }            else {                s += a[i + 1].prefix (min (a[i + 1].len () , p - 1LL));            }            ans += match (s , pat , p);        }        printf ("%I64d\n" , ans);    }    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-30 17:41:04, Gzip enabled