K - 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
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <cstdio>

using namespace std;

typedef long long ll;

int main()
{

	int x,y;
	cin>>x>>y;
	int num=(x+y)/2;
	printf("%d\n",num*(num-y));
	
	return 0;
}

沒想到竟然PE了,少輸換行符竟然還會錯,還是養成輸換行符的習慣吧。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章