Start: Jun, 05, 2019 15:00:00
2019春ACM通识课考试(第二场)
End: Jun, 05, 2019 18:00:00
Time elapsed:
Time remaining:

Problem_ID: F
Result: Accepted
Time: 9ms
Memory: 1712kB
Author: 2018212212139
In contest: 1271

#include<cstdio>
#include<iostream>
using namespace std;
int n,sa,sb,i,s1,s2,s3;
int a[7];
int main()
{
	cin>>a[1]>>a[2]>>a[3]>>a[4]>>a[5]>>a[6];
	sa=a[1]+a[2];
	sb=a[2]+a[3];
	s1=0,s2=0,s3=0;
	if(sa==sb)
	{
		for(i=1;i<sa;i++)
		{
			s1+=i*2;
		}
		s1+=sa;
		s1=s1*2;
		for(i=1;i<a[2];i++)
		{
			s2+=i*2;
		}
		s2=s2+a[2];
		for(i=1;i<a[5];i++)
		{
			s3+=i*2;
		}
		s3=s3+a[5];
		n=s1-s2-s3;
		printf("%d\n",n);
	}
	else
	{
		int a1,b;
		if(sa>sb)
			a1=sa,b=sb;
		else a1=sb,b=sa;

		for(i=1;i<=b;i++)
		{
			s1+=i*2;
		}
		s1=(s1-b)*2+2*(a1-b)*b;

		for(i=1;i<a[2];i++)
		{
			s2+=i*2;
		}
		s2=s2+a[2];
		for(i=1;i<a[5];i++)
		{
			s3+=i*2;
		}
		s3=s3+a[5];
		n=s1-s2-s3;
		printf("%d\n",n);
	}

	
}