D题通过率44.44%,求指点
D题 美食 通过率44.44%,想请教一下到底是哪里错了 #include<bits/stdc++.h> using namespace std; int main(){ long long n,x; long long a[100005],sum=0; memset(a,0,sizeof(a)); cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; sum+=a[i]/2; a[i]=a[i]%2; } long long i=1; while(i+1<=n){ if(a[i]==a[i+1]){ if(a[i]==1){ sum++; } i+=2; }else{ i++; } } cout<<sum; return 0; }