acm 2016/5/18 hpu15级练习 G

<div class="plm" style="text-align: center; font-size: 12pt; color: rgb(34, 34, 34); clear: both;"><div class="ptt" id="problem_title" style="font-size: 18pt; font-weight: bold; color: blue; padding: 10px;"><span style="color: green;">G - </span>Toy Army</div><span id="crawlSuccess" class="crawlInfo" style="display: inline;"><strong>Time Limit:</strong><span id="timeLimit">2000</span>MS     <strong>Memory Limit:</strong><span id="memoryLimit">262144</span>KB     <strong>64bit IO Format:</strong><span id="_64IOFormat">%I64d & %I64u</span></span><div id="problem_opt" style="font-size: 12px; margin-top: 10px;"><a target=_blank id="submit" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" style="display: inline-block; position: relative; padding: 0px; margin-right: 0.1em; cursor: pointer; vertical-align: middle; overflow: visible; font-family: Verdana, Arial, sans-serif; font-size: 1em; border: 1px solid rgb(211, 211, 211); color: rgb(85, 85, 85); border-radius: 4px; background: url(http://acm.hust.edu.cn/vjudge/jquery-ui-1.11.1.custom/images/ui-bg_glass_75_e3e4f8_1x400.png) 50% 50% repeat-x rgb(227, 228, 248);"><span class="ui-button-text" style="display: block; padding: 0.4em 1em;">Submit</span></a> <a target=_blank id="problem_status" href="http://acm.hust.edu.cn/vjudge/contest/view.action?cid=116190#status//G/0" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" style="display: inline-block; position: relative; padding: 0px; margin-right: 0.1em; cursor: pointer; vertical-align: middle; overflow: visible; text-decoration: none; font-family: Verdana, Arial, sans-serif; font-size: 1em; border: 1px solid rgb(211, 211, 211); color: rgb(85, 85, 85); border-radius: 4px; background: url(http://acm.hust.edu.cn/vjudge/jquery-ui-1.11.1.custom/images/ui-bg_glass_75_e3e4f8_1x400.png) 50% 50% repeat-x rgb(227, 228, 248);"><span class="ui-button-text" style="display: block; padding: 0.4em 1em;">Status</span></a> <a target=_blank id="problem_practice" target="_blank" href="http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=20292" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" style="display: inline-block; position: relative; padding: 0px; margin-right: 0.1em; cursor: pointer; vertical-align: middle; overflow: visible; text-decoration: none; font-family: Verdana, Arial, sans-serif; font-size: 1em; border: 1px solid rgb(211, 211, 211); color: rgb(85, 85, 85); border-radius: 4px; background: url(http://acm.hust.edu.cn/vjudge/jquery-ui-1.11.1.custom/images/ui-bg_glass_75_e3e4f8_1x400.png) 50% 50% repeat-x rgb(227, 228, 248);"><span class="ui-button-text" style="display: block; padding: 0.4em 1em;">Practice</span></a> <a target=_blank id="problem_origin" target="_blank" href="http://acm.hust.edu.cn/vjudge/problem/visitOriginUrl.action?id=20292" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" style="display: inline-block; position: relative; padding: 0px; margin-right: 0.1em; cursor: pointer; vertical-align: middle; overflow: visible; text-decoration: none; font-family: Verdana, Arial, sans-serif; font-size: 1em; border: 1px solid rgb(211, 211, 211); color: rgb(85, 85, 85); border-radius: 4px; background: url(http://acm.hust.edu.cn/vjudge/jquery-ui-1.11.1.custom/images/ui-bg_glass_75_e3e4f8_1x400.png) 50% 50% repeat-x rgb(227, 228, 248);"><span class="ui-button-text" style="display: block; padding: 0.4em 1em;">CodeForces 84A</span></a></div></div><div style="color: rgb(34, 34, 34); font-family: Verdana, Arial, sans-serif; font-size: 14px; width: 960px; margin: auto;"><div class="hiddable" id="vj_description" style="font-family: 'times new roman'; font-size: 17px;"><p class="pst" style="font-family: Arial, Helvetica, sans-serif; font-size: 18pt; font-weight: bold; color: blue; margin-bottom: 0px;">Description</p><div class="textBG" style="border-radius: 10px; padding: 10px; border-style: dotted; border-width: 2px; background-color: rgb(234, 235, 255);"><p>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.</p><p>There are two armies on the playing field each of which consists of <span class="tex-span" style="font-size: 21.25px;"><em>n</em></span> men (<span class="tex-span" style="font-size: 21.25px;"><em>n</em></span> 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.</p><p>The game "GAGA" consists of three steps: first Valera makes a move, then Arcady, then Valera again and the game ends.</p><p>You are asked to calculate the maximum total number of soldiers that may be killed during the game.</p></div></div><div class="hiddable" id="vj_input" style="font-family: 'times new roman'; font-size: 17px;"><p class="pst" style="font-family: Arial, Helvetica, sans-serif; font-size: 18pt; font-weight: bold; color: blue; margin-bottom: 0px;">Input</p><div class="textBG" style="border-radius: 10px; padding: 10px; border-style: dotted; border-width: 2px; background-color: rgb(234, 235, 255);"><p>The input data consist of a single integer <span class="tex-span" style="font-size: 21.25px;"><em>n</em></span> (<span class="tex-span" style="font-size: 21.25px;">2 ≤ <em>n</em> ≤ 10<sup class="upper-index">8</sup></span>, <span class="tex-span" style="font-size: 21.25px;"><em>n</em></span> is even). Please note that before the game starts there are <span class="tex-span" style="font-size: 21.25px;">2<em>n</em></span> soldiers on the fields.</p></div></div><div class="hiddable" id="vj_output" style="font-family: 'times new roman'; font-size: 17px;"><p class="pst" style="font-family: Arial, Helvetica, sans-serif; font-size: 18pt; font-weight: bold; color: blue; margin-bottom: 0px;">Output</p><div class="textBG" style="border-radius: 10px; padding: 10px; border-style: dotted; border-width: 2px; background-color: rgb(234, 235, 255);"><p>Print a single number — a maximum total number of soldiers that could be killed in the course of the game in three turns.</p></div></div><div class="hiddable" id="vj_sampleInput" style="font-family: 'times new roman'; font-size: 17px;"><p class="pst" style="font-family: Arial, Helvetica, sans-serif; font-size: 18pt; font-weight: bold; color: blue; margin-bottom: 0px;">Sample Input</p></div></div>
Output
3
Input
4
Output
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方死一半。
 
</pre><pre code_snippet_id="1687783" snippet_file_name="blog_20160518_3_7945206" name="code" class="html">#include <cstdio>
int main()
{
	int n;
	while(~scanf("%d",&n))
	{
		printf("%d\n",n+n/2);
	}
	return 0;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值