|
|
|
|
背景 Background |
|
|
为了for beginngers,特设此题,^_^
|
|
|
|
|
|
|
|
描述 Description |
|
|
N只猴子选大王,选举办法如下:排成一行,从头到尾1,2,3报数,凡报3的退出,余下的
从尾到头1,2,3报数,凡报3的退出...如此类推,当剩下两只猴子时,取这时报1的
为王,若想当猴王,请问当初应占据什么位置?
输入格式 Input Format
只有一个数为N(N≤100)。
输出格式 Output Format
只有一个数,为猴王当初占据的位置。
样例输入 Sample Input
10
样例输出 Sample Output
8 |
|
|
|
|
|
|
|
输入格式 Input Format |
|
|
只有一个数为N(N≤100)。
|
|
|
|
|
|
|
|
输出格式 Output Format |
|
|
只有一个数,为猴王当初占据的位置。 |
|
|
|
|
|
|
|
时间限制 Time Limitation |
|
|
各个测试点1s
|
|
|
|
|
|
|
|
注释 Hint |
|
|
Free Pascal Code:
-------------------
program Plus;
var a,b:longint;
begin
readln(a,b);
writeln(a+b);
end.
C++ Code:
-------------------
#include <iostream>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
cout<<a+b<<endl;
return 0;
}
|
|
|
|
|
|
|
|
|
Flag |
|
题号 |
P1295 |
|
其它 |
通过 |
7人 |
提交 |
27次 |
通过率 |
26% |
难度 |
2 |
|
|
|
|
|
|