A. Tiling with Hexagons

time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Several ages ago Berland was a kingdom. The King of Berland adored math. That's why, when he first visited one of his many palaces, he first of all paid attention to the floor in one hall. The floor was tiled with hexagonal tiles.

The hall also turned out hexagonal in its shape. The King walked along the perimeter of the hall and concluded that each of the six sides has abcab and c adjacent tiles, correspondingly.

To better visualize the situation, look at the picture showing a similar hexagon for a = 2b = 3 and c = 4.

According to the legend, as the King of Berland obtained the values ab and c, he almost immediately calculated the total number of tiles on the hall floor. Can you do the same?

Input

The first line contains three integers: ab and c (2 ≤ a, b, c ≤ 1000).

Output

Print a single number — the total number of tiles on the hall floor.

Sample test(s)
input
2 3 4
output
18


解题说明:此题考查几何方面的知识,给出三个值通过规律找出问题的答案。首先可以把原图像分为下面两块:


红色标记部分个数为b*c,上面是一圈(b+c-1)个小块,注意这里a=2,故只有一层,,如果a>2就应该是a-1层。

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;

int main()
{
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	printf("%d\n",b*c+(a-1)*(b+c-1));
	return 0;
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值