Toy Army<水题>
来源:互联网 发布:颐讯软件 编辑:程序博客网 时间:2024/06/08 06:24
Description
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 ≤ 108,n is even). Please note that before the game starts there are2n 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.
Sample Input
2
3
4
6
Sample Output
Hint
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.
题意 有两对士兵 人数为偶数n 进行三次射击 一队先射击,二队再射击,一队再射击 每次可以一人射击一人也可以多人射击一人 问三次射击之后死亡的最多士兵人数
思路 为使伤亡人数最大其中一队要全部死亡,另一方尽可能有最大的伤亡数 最大伤亡数位n/2 最终两队伤亡数最大为n*3/2
#include<cstdio>int main(){int n;scanf("%d",&n);printf("%d",n*3/2);return 0;}
- Toy Army<水题>
- Toy Army
- Codeforces 84A:Toy Army(水题)
- A. Toy Army
- CodeForces 84. A Toy Army
- Codeforces 84A:Toy Army
- 【CodeForces】Toy Army(数学)
- Codeforces 84A Toy Army
- 【水推理】#72 A. Toy Army
- UVa12356 - Army Buddies(水题)
- Army
- 【codeforces】--Toy Army(两军轮流射击怎样死亡最多,数学)
- The Useless Toy(水题 暴力枚举)
- POJ 3069 Saruman's Army(水题,简单的贪心)
- A. Army
- SPOJ ARMY
- codeforces Army
- H - The Child and Toy-CodeForces 437C-水题
- spark性能优化:数据倾斜调优
- JSON-OC 转换对照表
- 机器学习排序之Learning to Rank简单介绍
- Java数组
- RDD和DataFrame转换(Java+Scala)
- Toy Army<水题>
- 5.UIButton
- ORA-12154: TNS: 无法解析指定的连接标识符(摘)
- JDK安装后 没有tools.jar 和dt.jar包的解决办法
- 批量迁移MySQL历史数据到历史库【Python脚本】
- DIY:用开源软件搭建自己的物联网
- 把excel中的数据粘贴到PLSQL Developer中
- 技术收藏
- 多线程与数据库连接数