QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#550019#9255. Python Programucup-team3555#WA 0ms3532kbC++201.0kb2024-09-07 08:53:472024-09-07 08:53:47

Judging History

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

  • [2024-09-07 08:53:47]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3532kb
  • [2024-09-07 08:53:47]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define ll long long

const int inf=1e9;
int a,b,c,d,e,f;
ll ans=0,n;
string S,T;
char A,ch,B;

int read(){
  ch=getchar();int x=0,f=1;
  if(ch=='A') return inf;
  while(!isdigit(ch)){if(ch=='-') f=-1;ch=getchar();}
  while(isdigit(ch)){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}
  return x*f;
}

int main(){
  cin>>S;
  cin>>S>>A;
  
  ch=getchar();
  while(ch!='(') ch=getchar();

  cin>>a;ch=getchar();cin>>b;ch=getchar();
  if(ch==')') c=1;
  else cin>>c;

  cin>>S;cin>>S>>B;

  ch=getchar();
  while(ch!='(') ch=getchar();

  d=read(),e=read();

  if(ch==')') f=1;
  else f=read();

  if(c==0||(c>0&&a>=b)||(c<0&&a<=b)) return cout<<"0\n",0;

  for(int i=a;i<b;i+=c){
	int D,E,F,k;
	D=d==inf?i:d;
	E=e==inf?i:e;
	F=f==inf?i:f;

	if(F==0||(F>0&&D>=E)||(F<0&&D<=E)) continue;

    if(abs(D-E)%abs(F)==0) k=abs(D-E)/abs(F)-1;
	else k=abs(D-E)/abs(F);
  
    ans+=1ll*(1ll*D+1ll*k*F)*(k+1)/2ll;
  }
  cout<<ans;

  return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3532kb

input:

ans=0
for a in range(1,3):
    for b in range(5,1,-2):
        ans+=b
print(ans)

output:

6

result:

wrong answer 1st lines differ - expected: '16', found: '6'