思维测试
来源:互联网 发布:网络主播年收入 编辑:程序博客网 时间:2024/06/05 00:25
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 ofn 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
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.
题意:
共有三次开枪机会,每次可以为任何人选定唯一敌人(a的敌人是b,b的敌人是a的情况是错误的);
三次开枪后,求最多能死几人?
解题:
第一次:a方瞄准b方一半:
第二次:b方剩余一半瞄准a方一半:
第三次:a方剩余一半瞄准b方剩余的一半:
代码:
#include<stdio.h> int main() { int n,result; scanf("%d",&n); result=(n/2)*3; printf("%d",result); return 0; }
- 思维测试
- 测试思维
- 测试性思维
- 测试之BT思维
- jmeter(二)测试思维
- 用户体验测试思维
- 学习日志-----测试思维
- 测试思维是怎样的一种思维?
- 测试思维是怎样的一种思维?
- 路人测试VS研发思维
- 大话测试之BT思维
- 哪些测试中的逆向思维
- 测试流程思维导图
- 软件测试中的用户思维
- 软件测试的测试思维记录
- 软件测试 逆向思维很关键
- 软件测试基础思维导图
- 1软件测试基础思维导图
- Swift快速集成下拉刷新和上拉加载更多
- 八皇后问题(JAVA)
- 【Android 基础】Google新推出的Android布局控件FlexboxLayout
- js/jquery去掉空格,回车,换行示例代码
- STM32F429-Discovery 使用stlink-1.2.0 在Linux下烧写调试RTEMS
- 思维测试
- javadoc 自动生成——利用MyEclipse
- Android中Fragment数据保存和恢复
- select的find选择器偶尔失效
- Spring学习总结(9)——Spring AOP总结
- eclipse 导入工程 出现很多错误的处理办法
- afnetworking开启https访问
- retrofit的使用
- JVM的内存模型