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_20613766_6535.cpp:20:72: error: stray '#' in program
     using namespace std;const double eps(1e-8);typedef long long lint; #define maxn 1110vector <int> v[maxn]; struct polynomial{    int coe[maxn];    int len;    polynomial()    {        memset(coe, 0, sizeof(coe));        len = 1;    }    void output()    {        printf("(");        for(int i = len - 1; i >= 0; i--)        {            if(coe[i] == 0) continue;            if(i == 0)            {                if(coe[i] > 0) printf("+");                printf("%d", coe[i]);                continue;            }            if(coe[i] > 0 && i != len - 1) printf("+");            if(coe[i] == -1) printf("-");            if(abs(coe[i]) != 1) printf("%d", coe[i]);            if(i > 1)                printf("x^%d", i);            else printf("x");        }        printf(")");        return;    }    polynomial operator / (const polynomial pol);}; polynomial polynomial :: operator / (const polynomial pol){    polynomial ret;    ret.len = len - pol.len + 1;    for(int i = len - 1; i >= pol.len - 1; i--)    {        int tim = coe[i] / pol.coe[pol.len - 1];        if(tim != 0)        {            for(int j = 0; j < pol.len; j++)                coe[i - j] -= tim*pol.coe[pol.len - 1 - j];            ret.coe[i - pol.len + 1] = tim;        }    }    return ret;} polynomial p[maxn]; bool cmp(int i, int j){    if(p[i].len != p[j].len) return p[i].len < p[j].len;    for(int k = p[i].len - 1; k >= 0; k--)        if(p[i].coe[k] != p[j].coe[k])        {            if(abs(p[i].coe[k]) == abs(p[j].coe[k]))                return p[i].coe[k] < 0;            else return abs(p[i].coe[k]) < abs(p[j].coe[k]);        }    return false;} int main(){    p[1].coe[0] = -1;    p[1].coe[1] = 1;    p[1].len = 2;    for(int i = 2; i <= 1100; i++)    {        p[i].coe[0] = -1;        p[i].coe[i] = 1;        p[i].len = i + 1;        p[i] = p[i]/p[1];        v[i].push_back(1);        for(int j = 2; j*j <= i; j++)        {            if(i % j == 0)            {                p[i] = p[i]/p[j];                v[i].push_back(j);                if(j*j != i) p[i] = p[i]/p[i / j], v[i].push_back(i / j);            }        }        v[i].push_back(i);    }    int n;    while(scanf("%d", &n), n)    {        if(n == 1)        {            printf("x-1\n");            continue;        }        sort(v[n].begin(), v[n].end(), cmp);        for(int i = 0, sz = v[n].size(); i < sz; i++)            p[v[n][i]].output();        printf("\n");    }    return 0;}
                                                                        ^
0_0_20613766_6535.cpp:20:73: error: 'define' does not name a type
     using namespace std;const double eps(1e-8);typedef long long lint; #define maxn 1110vector <int> v[maxn]; struct polynomial{    int coe[maxn];    int len;    polynomial()    {        memset(coe, 0, sizeof(coe));        len = 1;    }    void output()    {        printf("(");        for(int i = len - 1; i >= 0; i--)        {            if(coe[i] == 0) continue;            if(i == 0)            {                if(coe[i] > 0) printf("+");                printf("%d", coe[i]);                continue;            }            if(coe[i] > 0 && i != len - 1) printf("+");            if(coe[i] == -1) printf("-");            if(abs(coe[i]) != 1) printf("%d", coe[i]);            if(i > 1)                printf("x^%d", i);            else printf("x");        }        printf(")");        return;    }    polynomial operator / (const polynomial pol);}; polynomial polynomial :: operator / (const polynomial pol){    polynomial ret;    ret.len = len - pol.len + 1;    for(int i = len - 1; i >= pol.len - 1; i--)    {        int tim = coe[i] / pol.coe[pol.len - 1];        if(tim != 0)        {            for(int j = 0; j < pol.len; j++)                coe[i - j] -= tim*pol.coe[pol.len - 1 - j];            ret.coe[i - pol.len + 1] = tim;        }    }    return ret;} polynomial p[maxn]; bool cmp(int i, int j){    if(p[i].len != p[j].len) return p[i].len < p[j].len;    for(int k = p[i].len - 1; k >= 0; k--)        if(p[i].coe[k] != p[j].coe[k])        {            if(abs(p[i].coe[k]) == abs(p[j].coe[k]))                return p[i].coe[k] < 0;            else return abs(p[i].coe[k]) < abs(p[j].coe[k]);        }    return false;} int main(){    p[1].coe[0] = -1;    p[1].coe[1] = 1;    p[1].len = 2;    for(int i = 2; i <= 1100; i++)    {        p[i].coe[0] = -1;        p[i].coe[i] = 1;        p[i].len = i + 1;        p[i] = p[i]/p[1];        v[i].push_back(1);        for(int j = 2; j*j <= i; j++)        {            if(i % j == 0)            {                p[i] = p[i]/p[j];                v[i].push_back(j);                if(j*j != i) p[i] = p[i]/p[i / j], v[i].push_back(i / j);            }        }        v[i].push_back(i);    }    int n;    while(scanf("%d", &n), n)    {        if(n == 1)        {            printf("x-1\n");            continue;        }        sort(v[n].begin(), v[n].end(), cmp);        for(int i = 0, sz = v[n].size(); i < sz; i++)            p[v[n][i]].output();        printf("\n");    }    return 0;}
                                                                         ^
0_0_20613766_6535.cpp:20:141: error: 'maxn' was not declared in this scope
     using namespace std;const double eps(1e-8);typedef long long lint; #define maxn 1110vector <int> v[maxn]; struct polynomial{    int coe[maxn];    int len;    polynomial()    {        memset(coe, 0, sizeof(coe));        len = 1;    }    void output()    {        printf("(");        for(int i = len - 1; i >= 0; i--)        {            if(coe[i] == 0) continue;            if(i == 0)            {                if(coe[i] > 0) printf("+");                printf("%d", coe[i]);                continue;            }            if(coe[i] > 0 && i != len - 1) printf("+");            if(coe[i] == -1) printf("-");            if(abs(coe[i]) != 1) printf("%d", coe[i]);            if(i > 1)                printf("x^%d", i);            else printf("x");        }        printf(")");        return;    }    polynomial operator / (const polynomial pol);}; polynomial polynomial :: operator / (const polynomial pol){    polynomial ret;    ret.len = len - pol.len + 1;    for(int i = len - 1; i >= pol.len - 1; i--)    {        int tim = coe[i] / pol.coe[pol.len - 1];        if(tim != 0)        {            for(int j = 0; j < pol.len; j++)                coe[i - j] -= tim*pol.coe[pol.len - 1 - j];            ret.coe[i - pol.len + 1] = tim;        }    }    return ret;} polynomial p[maxn]; bool cmp(int i, int j){    if(p[i].len != p[j].len) return p[i].len < p[j].len;    for(int k = p[i].len - 1; k >= 0; k--)        if(p[i].coe[k] != p[j].coe[k])        {            if(abs(p[i].coe[k]) == abs(p[j].coe[k]))                return p[i].coe[k] < 0;            else return abs(p[i].coe[k]) < abs(p[j].coe[k]);        }    return false;} int main(){    p[1].coe[0] = -1;    p[1].coe[1] = 1;    p[1].len = 2;    for(int i = 2; i <= 1100; i++)    {        p[i].coe[0] = -1;        p[i].coe[i] = 1;        p[i].len = i + 1;        p[i] = p[i]/p[1];        v[i].push_back(1);        for(int j = 2; j*j <= i; j++)        {            if(i % j == 0)            {                p[i] = p[i]/p[j];                v[i].push_back(j);                if(j*j != i) p[i] = p[i]/p[i / j], v[i].push_back(i / j);            }        }        v[i].push_back(i);    }    int n;    while(scanf("%d", &n), n)    {        if(n == 1)        {            printf("x-1\n");            continue;        }        sort(v[n].begin(), v[n].end(), cmp);        for(int i = 0, sz = v[n].size(); i < sz; i++)            p[v[n][i]].output();        printf("\n");    }    return 0;}
                                                                                                                                             ^
0_0_20613766_6535.cpp: In constructor 'polynomial::polynomial()':
0_0_20613766_6535.cpp:20:195: error: 'coe' was not declared in this scope
     using namespace std;const double eps(1e-8);typedef long long lint; #define maxn 1110vector <int> v[maxn]; struct polynomial{    int coe[maxn];    int len;    polynomial()    {        memset(coe, 0, sizeof(coe));        len = 1;    }    void output()    {        printf("(");        for(int i = len - 1; i >= 0; i--)        {            if(coe[i] == 0) continue;            if(i == 0)            {                if(coe[i] > 0) printf("+");                printf("%d", coe[i]);                continue;            }            if(coe[i] > 0 && i != len - 1) printf("+");            if(coe[i] == -1) printf("-");            if(abs(coe[i]) != 1) printf("%d", coe[i]);            if(i > 1)                printf("x^%d", i);            else printf("x");        }        printf(")");        return;    }    polynomial operator / (const polynomial pol);}; polynomial polynomial :: operator / (const polynomial pol){    polynomial ret;    ret.len = len - pol.len + 1;    for(int i = len - 1; i >= pol.len - 1; i--)    {        int tim = coe[i] / pol.coe[pol.len - 1];        if(tim != 0)        {            for(int j = 0; j < pol.len; j++)                coe[i - j] -= tim*pol.coe[pol.len - 1 - j];            ret.coe[i - pol.len + 1] = tim;        }    }    return ret;} polynomial p[maxn]; bool cmp(int i, int j){    if(p[i].len != p[j].len) return p[i].len < p[j].len;    for(int k = p[i].len - 1; k >= 0; k--)        if(p[i].coe[k] != p[j].coe[k])        {            if(abs(p[i].coe[k]) == abs(p[j].coe[k]))                return p[i].coe[k] < 0;            else return abs(p[i].coe[k]) < abs(p[j].coe[k]);        }    return false;} int main(){    p[1].coe[0] = -1;    p[1].coe[1] = 1;    p[1].len = 2;    for(int i = 2; i <= 1100; i++)    {        p[i].coe[0] = -1;        p[i].coe[i] = 1;        p[i].len = i + 1;        p[i] = p[i]/p[1];        v[i].push_back(1);        for(int j = 2; j*j <= i; j++)        {            if(i % j == 0)            {                p[i] = p[i]/p[j];                v[i].push_back(j);                if(j*j != i) p[i] = p[i]/p[i / j], v[i].push_back(i / j);            }        }        v[i].push_back(i);    }    int n;    while(scanf("%d", &n), n)    {        if(n == 1)        


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 05:25:55, Gzip enabled