📄 problem 1350.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0047)http://acm.zju.edu.cn/show_problem.php?pid=1350 -->
<HTML><HEAD><TITLE>Problem 1350</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.2900.3157" name=GENERATOR></HEAD>
<BODY>
<CENTER><IMG src="Problem 1350.files/logo.gif" align=center></IMG></CENTER>
<HR>
<CENTER><FONT color=blue size=+2>The Drunk Jailer</FONT></CENTER>
<HR>
<CENTER><FONT color=green>Time limit:</FONT> 1 Seconds <FONT
color=green>Memory limit: </FONT>32768K </FONT><BR><FONT
color=green>Total Submit:</FONT> 3168 <FONT color=green>Accepted
Submit:</FONT> 2039 </CENTER>
<HR>
A certain prison contains a long hall of n cells, each right next to each other.
Each cell has a prisoner in it, and each cell is locked.
<P>One night, the jailer gets bored and decides to play a game. For round 1 of
the game, he takes a drink of whiskey, and then runs down the hall unlocking
each cell. For round 2, he takes a drink of whiskey, and then runs down the hall
locking every other cell (cells 2, 4, 6, …). For round 3, he takes a drink of
whiskey, and then runs down the hall. He visits every third cell (cells 3, 6, 9,
…). If the cell is locked, he unlocks it; if it is unlocked, he locks it. He
repeats this for n rounds, takes a final drink, and passes out.</P>
<P>Some number of prisoners, possibly zero, realizes that their cells are
unlocked and the jailer is incapacitated. They immediately escape.</P>
<P>Given the number of cells, determine how many prisoners escape jail.<BR></P>
<P><B><BR>Input</B></P>
<P>The first line of input contains a single positive integer. This is the
number of lines that follow. Each of the following lines contains a single
integer between 5 and 100, inclusive, which is the number of cells n.<BR></P>
<P><BR><B>Output</B><BR><BR>For each line, you must print out the number of
prisoners that escape when the prison has n cells.</P>
<P><BR><B>Sample Input</B></P>
<P>2<BR>5<BR>100 </P>
<P><B>Sample Output</B></P>
<P>2<BR>10<BR></P>
<HR>
<FONT color=green size=+1>Problem Source: </FONT><I>Greater New York 2002</I>
<HR>
<CENTER><A href="http://acm.zju.edu.cn/submit.php?pid=1350">Submit</A>
<A href="http://acm.zju.edu.cn/list_problem.php?vol=4">Back</A>
<A
href="http://acm.zju.edu.cn/problem_status.php?pid=1350">Status</A> </CENTER>
<HR>
<CENTER>
<TABLE width="100%" border=0>
<TBODY>
<TR>
<TD align=right width="65%"><A href="http://acm.zju.edu.cn/"><FONT
color=red>Zhejiang University Online Judge</FONT></A> <A
href="http://acm.zju.edu.cn/"><FONT color=red>V1.0</FONT></A></TD>
<TD align=right width="35%"><A href="http://www.zzhang.cn/"><FONT
color=#ffffff
size=-3>Book</FONT></A></TD></TR></TBODY></TABLE></CENTER></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -