E - Class
Avin has two integers a, b (1 ≤ a, b ≤ 1, 000). Given x = a + b and y = a - b, can you calculate a*b?
Input
The first line contains two integers x, y.
Output
Print the result of a*b.
Sample Input
4 2
Sample Output
3
题解:(x+y)/2=a , (x-y)/2=b.
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
int a,b,x,y,s;
int main()
{
scanf("%d%d",&a,&b);
x=(a+b)/2;
y=(a-b)/2;
s=x*y;
printf("%d\n",s);
return 0;
}