Codeforces 84A:Toy Army(水题)

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

The hero of our story, Valera, and his best friend Arcady are still in school, and therefore they spend all the free time playing turn-based strategy "GAGA: Go And Go Again". The gameplay is as follows.

There are two armies on the playing field each of which consists of n men (n is always even). The current player specifies for each of her soldiers an enemy's soldier he will shoot (a target) and then all the player's soldiers shot simultaneously. This is a game world, and so each soldier shoots perfectly, that is he absolutely always hits the specified target. If an enemy soldier is hit, he will surely die. It may happen that several soldiers had been indicated the same target. Killed soldiers do not participate in the game anymore.

The game "GAGA" consists of three steps: first Valera makes a move, then Arcady, then Valera again and the game ends.

You are asked to calculate the maximum total number of soldiers that may be killed during the game.

Input

The input data consist of a single integer n (2 ≤ n ≤ 108n is even). Please note that before the game starts there are 2n soldiers on the fields.

Output

Print a single number — a maximum total number of soldiers that could be killed in the course of the game in three turns.

Examples
input
2
output
3
input
4
output
6
Note

The first sample test:

1) Valera's soldiers 1 and 2 shoot at Arcady's soldier 1.

2) Arcady's soldier 2 shoots at Valera's soldier 1.

3) Valera's soldier 1 shoots at Arcady's soldier 2.

There are 3 soldiers killed in total: Valera's soldier 1 and Arcady's soldiers 1 and 2.


题意:有a、b两个军队,两军队人数相等,都为n(偶数),a对先开枪射击b队,b队再射击a队,a队再射击b队,问这三次开枪最多死多少人。(PS:多个人可共同射击一个人,一个人也可以射击一个人)。

思路:比如第一次a射击b,为了保证本次射击的人最多,并且下次射本队的人最多,所以采取折中的办法,a射死b一半的人,然后第二次还是这个原理,b射死a一半的人,第三次就该a把b都射死了。所以总共死的人数是n/2(射死b队的人)+n/2(射死a队的人)+n/2(b队剩下的人),结果为n*3/2。

#include <stdio.h>
int main()
{
	int n;
	while(scanf("%d",&n)!=EOF)
	{
		printf("%d\n",n*3/2);
	}
	return 0;
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值