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_20612912_3014.cpp:4:25: error: stray '#' in program
     using namespace std;#define L 1000100int a[L],b[L],p[L];long long min(long long x,long long y){    if (x<y) return x;    return y;}int main(){    int T;    int cas=1;    scanf("%d",&T);    while(T--)    {        int n;        scanf("%d",&n);        for(int i=1;i<=n;i++)  scanf("%d",&a[i]);         int len=1;        b[len]=a[1];        for(int i=2;i<=n;i++)  if(a[i]!=a[i-1])  b[++len]=a[i];         p[1]=0;        for(int i=2;i<=len;i++)  p[i]=b[i]-b[i-1];         long long sum=0,ans=0;        for(int i=2;i<=len;i++)        {            if(p[i]*sum<0)  ans+=min(abs(sum),abs(p[i]));            sum+=p[i];        }         sum=abs(sum);        ans+=sum;        printf("Case %d: %I64d %I64d\n",cas++,ans,sum+1);    }    return 0;}
                         ^
0_0_20612912_3014.cpp:4:26: error: 'define' does not name a type
     using namespace std;#define L 1000100int a[L],b[L],p[L];long long min(long long x,long long y){    if (x<y) return x;    return y;}int main(){    int T;    int cas=1;    scanf("%d",&T);    while(T--)    {        int n;        scanf("%d",&n);        for(int i=1;i<=n;i++)  scanf("%d",&a[i]);         int len=1;        b[len]=a[1];        for(int i=2;i<=n;i++)  if(a[i]!=a[i-1])  b[++len]=a[i];         p[1]=0;        for(int i=2;i<=len;i++)  p[i]=b[i]-b[i-1];         long long sum=0,ans=0;        for(int i=2;i<=len;i++)        {            if(p[i]*sum<0)  ans+=min(abs(sum),abs(p[i]));            sum+=p[i];        }         sum=abs(sum);        ans+=sum;        printf("Case %d: %I64d %I64d\n",cas++,ans,sum+1);    }    return 0;}
                          ^
0_0_20612912_3014.cpp: In function 'int main()':
0_0_20612912_3014.cpp:4:289: error: 'a' was not declared in this scope
     using namespace std;#define L 1000100int a[L],b[L],p[L];long long min(long long x,long long y){    if (x<y) return x;    return y;}int main(){    int T;    int cas=1;    scanf("%d",&T);    while(T--)    {        int n;        scanf("%d",&n);        for(int i=1;i<=n;i++)  scanf("%d",&a[i]);         int len=1;        b[len]=a[1];        for(int i=2;i<=n;i++)  if(a[i]!=a[i-1])  b[++len]=a[i];         p[1]=0;        for(int i=2;i<=len;i++)  p[i]=b[i]-b[i-1];         long long sum=0,ans=0;        for(int i=2;i<=len;i++)        {            if(p[i]*sum<0)  ans+=min(abs(sum),abs(p[i]));            sum+=p[i];        }         sum=abs(sum);        ans+=sum;        printf("Case %d: %I64d %I64d\n",cas++,ans,sum+1);    }    return 0;}
                                                                                                                                                                                                                                                                                                 ^
0_0_20612912_3014.cpp:4:322: error: 'b' was not declared in this scope
     using namespace std;#define L 1000100int a[L],b[L],p[L];long long min(long long x,long long y){    if (x<y) return x;    return y;}int main(){    int T;    int cas=1;    scanf("%d",&T);    while(T--)    {        int n;        scanf("%d",&n);        for(int i=1;i<=n;i++)  scanf("%d",&a[i]);         int len=1;        b[len]=a[1];        for(int i=2;i<=n;i++)  if(a[i]!=a[i-1])  b[++len]=a[i];         p[1]=0;        for(int i=2;i<=len;i++)  p[i]=b[i]-b[i-1];         long long sum=0,ans=0;        for(int i=2;i<=len;i++)        {            if(p[i]*sum<0)  ans+=min(abs(sum),abs(p[i]));            sum+=p[i];        }         sum=abs(sum);        ans+=sum;        printf("Case %d: %I64d %I64d\n",cas++,ans,sum+1);    }    return 0;}
                                                                                                                                                                                                                                                                                                                                  ^
0_0_20612912_3014.cpp:4:329: error: 'a' was not declared in this scope
     using namespace std;#define L 1000100int a[L],b[L],p[L];long long min(long long x,long long y){    if (x<y) return x;    return y;}int main(){    int T;    int cas=1;    scanf("%d",&T);    while(T--)    {        int n;        scanf("%d",&n);        for(int i=1;i<=n;i++)  scanf("%d",&a[i]);         int len=1;        b[len]=a[1];        for(int i=2;i<=n;i++)  if(a[i]!=a[i-1])  b[++len]=a[i];         p[1]=0;        for(int i=2;i<=len;i++)  p[i]=b[i]-b[i-1];         long long sum=0,ans=0;        for(int i=2;i<=len;i++)        {            if(p[i]*sum<0)  ans+=min(abs(sum),abs(p[i]));            sum+=p[i];        }         sum=abs(sum);        ans+=sum;        printf("Case %d: %I64d %I64d\n",cas++,ans,sum+1);    }    return 0;}
                                                                                                                                                                                                                                                                                                                                         ^
0_0_20612912_3014.cpp:4:406: error: 'p' was not declared in this scope
     using namespace std;#define L 1000100int a[L],b[L],p[L];long long min(long long x,long long y){    if (x<y) return x;    return y;}int main(){    int T;    int cas=1;    scanf("%d",&T);    while(T--)    {        int n;        scanf("%d",&n);        for(int i=1;i<=n;i++)  scanf("%d",&a[i]);         int len=1;        b[len]=a[1];        for(int i=2;i<=n;i++)  if(a[i]!=a[i-1])  b[++len]=a[i];         p[1]=0;        for(int i=2;i<=len;i++)  p[i]=b[i]-b[i-1];         long long sum=0,ans=0;        for(int i=2;i<=len;i++)        {            if(p[i]*sum<0)  ans+=min(abs(sum),abs(p[i]));            sum+=p[i];        }         sum=abs(sum);        ans+=sum;        printf("Case %d: %I64d %I64d\n",cas++,ans,sum+1);    }    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-29 20:12:06, Gzip enabled