QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#736683#6810. Array ConcatenationcaiwenCompile Error//C++14632b2024-11-12 12:32:462024-11-12 12:32:46

Judging History

你现在查看的是最新测评结果

  • [2024-11-12 12:32:46]
  • 评测
  • [2024-11-12 12:32:46]
  • 提交

answer

#include<cstdio>using namespace std;const long long M=1e9+7;int main(){	long long n,m,x=0,y=0,g=0;	scanf("%Ld%Ld",&n,&m);	for(long long i=1;i<=n;i++)	{		long long a;		scanf("%Ld",&a);		x+=a*i;		y+=a*(n-i+1);		g+=a;		x%=M;		y%=M;		g%=M;	}	if(y>=x)	{		long long h=0,pw=1;		for(long long i=1;i<=m;i++)		{			pw*=2;			pw%=M;		}		h+=y*pw;		h%=M;		long long p=pw*(pw-1)/2,q=n*g;		p%=M;		q%=M;		h+=p*q;		h%=M;		printf("%Ld",h);	}	else	{		long long h=0,pw=1;		for(long long i=1;i<m;i++)		{			pw*=2;			pw%=M;		}		h+=y*pw+x*pw;		h%=M;		pw*=2;		pw%=M;		long long p=pw*(pw-1)/2,q=n*g;		p%=M;		q%=M;		h+=p*q;		h%=M;		printf("%Ld",h);	}	return 0;}

Details

answer.code:1:23: warning: extra tokens at end of #include directive
    1 | #include<cstdio>using namespace std;const long long M=1e9+7;int main(){ long long n,m,x=0,y=0,g=0;      scanf("%Ld%Ld",&n,&m);  for(long long i=1;i<=n;i++)     {               long long a;            scanf("%Ld",&a);                x+=a*i;         y+=a*(n-i+1);           g+=a;           x%=M;           y%=M;           g%=M;   }       if(y>=x)        {               long long h=0,pw=1;             for(long long i=1;i<=m;i++)             {                       pw*=2;                  pw%=M;          }               h+=y*pw;                h%=M;           long long p=pw*(pw-1)/2,q=n*g;          p%=M;           q%=M;           h+=p*q;         h%=M;           printf("%Ld",h);        }       else    {               long long h=0,pw=1;             for(long long i=1;i<m;i++)              {                       pw*=2;                  pw%=M;          }               h+=y*pw+x*pw;           h%=M;           pw*=2;          pw%=M;          long long p=pw*(pw-1)/2,q=n*g;          p%=M;           q%=M;           h+=p*q;         h%=M;           printf("%Ld",h);        }       return 0;}
      |                       ^~~~~~~~~
answer.code:1:9: fatal error: cstdio>usin: No such file or directory
    1 | #include<cstdio>using namespace std;const long long M=1e9+7;int main(){ long long n,m,x=0,y=0,g=0;      scanf("%Ld%Ld",&n,&m);  for(long long i=1;i<=n;i++)     {               long long a;            scanf("%Ld",&a);                x+=a*i;         y+=a*(n-i+1);           g+=a;           x%=M;           y%=M;           g%=M;   }       if(y>=x)        {               long long h=0,pw=1;             for(long long i=1;i<=m;i++)             {                       pw*=2;                  pw%=M;          }               h+=y*pw;                h%=M;           long long p=pw*(pw-1)/2,q=n*g;          p%=M;           q%=M;           h+=p*q;         h%=M;           printf("%Ld",h);        }       else    {               long long h=0,pw=1;             for(long long i=1;i<m;i++)              {                       pw*=2;                  pw%=M;          }               h+=y*pw+x*pw;           h%=M;           pw*=2;          pw%=M;          long long p=pw*(pw-1)/2,q=n*g;          p%=M;           q%=M;           h+=p*q;         h%=M;           printf("%Ld",h);        }       return 0;}
      |         ^~~~~~~~~~~~~
compilation terminated.