A - Golden Plate CodeForces - 1072A ----小shi shi 给小天天的 Day1

You have a plate and you want to add some gilding to it. The plate is a rectangle that we split into w×hw×h cells. There should be kk gilded rings, the first one should go along the edge of the plate, the second one — 22 cells away from the edge and so on. Each ring has a width of 11 cell. Formally, the ii-th of these rings should consist of all bordering cells on the inner rectangle of size (w−4(i−1))×(h−4(i−1))(w−4(i−1))×(h−4(i−1)).

 The picture corresponds to the third example.

Your task is to compute the number of cells to be gilded.

Input

The only line contains three integers ww, hh and kk (3≤w,h≤1003≤w,h≤100, 1≤k≤⌊min(n,m)+14⌋1≤k≤⌊min(n,m)+14⌋, where ⌊x⌋⌊x⌋ denotes the number xx rounded down) — the number of rows, columns and the number of rings, respectively.

Output

Print a single positive integer — the number of cells to be gilded.

Examples

Input

3 3 1

Output

8

Input

7 9 1

Output

28

Input

7 9 2

Output

40

Note

The first example is shown on the picture below.

The second example is shown on the picture below.

The third example is shown in the problem description.

题意:

给你一个w*h个小方格组成的长方形 , 求该长方形涂了金色的方格数。

K层 , 第一层是长方形的四周 , 接下来每次都会往内部进俩格。

思路:

就求周长呗 , k>1 , 长宽各减二再继续加上周长 , 直到K次结束。

代码:

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int w , h , k , ans = 0;
	scanf("%d %d %d" , &w , &h , &k);
	while(k--)
	{
		ans+= (w+h-2)*2;
		w = w-4;
		h = h-4;
		
	}
	printf("%d\n" , ans);
	return 0;
 } 

 

全部评论

相关推荐

程序员牛肉:主要是因为小厂的资金本来就很吃紧,所以更喜欢有实习经历的同学。来了就能上手。 而大厂因为钱多,实习生一天三四百的就不算事。所以愿意培养你,在面试的时候也就不在乎你有没有实习(除非是同级别大厂的实习。) 按照你的简历来看,同质化太严重了。项目也很烂大街。 要么换项目,要么考研。 你现在选择工作的话,前景不是很好了。
点赞 评论 收藏
分享
05-14 20:34
门头沟学院 Java
窝补药贝八股:管他们,乱说,反正又不去,直接说680
点赞 评论 收藏
分享
身边有人上海、深圳&nbsp;6、7k&nbsp;都去了,真就带薪上班了。
程序员小白条:木的办法, 以后越来越差,还是家附近宅着吧,毕业的人越来越多,岗位都提供不出来,经济又过了人口红利期
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务