22141_Godofgamblers

2022-5-16 18:21| 发布者: Hocassian| 查看: 31| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-5-89506144571300-Problem List-采集的数据-后羿采集器.html

Pro.ID

22141

Title

God of gamblers

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=22141

AC

1

Submit

23

Ratio

4.35%

时间&空间限制

  • Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    Have you ever seen the movie "God of gamblers"?

    Yes. it's very exciting! You must be attracted by the deft skill of the god of gamblers.

    He can play the cards as he wish. The action of shuffling cards is extremely handsome.

    How I wish I had such a pair of hands! However, it will he only a dream forever.

    There is a popular method of shuffling cards. Suppose you have a stack ot 2×n cards.

    Divide them into two stacks, one with the first n cards while another with the last n cards.

    Then mix the two stacks of cards uniformly. That is the i-th card of the original stack is placed in the p(i)-th position of the new stack where p(i) is a function defined like this:

    Give you an integer n. Calculate the minimum positive number of shuffles that makes the cards have the same order as the original stack.

    输入

    A line containing an integer n which is less than 109.

    There are multiple test cases. lnput will be terminated by EOF.

    输出

    Description

    Have you ever seen the movie "God of gamblers"?

    Yes. it's very exciting! You must be attracted by the deft skill of the god of gamblers.

    He can play the cards as he wish. The action of shuffling cards is extremely handsome.

    How I wish I had such a pair of hands! However, it will he only a dream forever.

    There is a popular method of shuffling cards. Suppose you have a stack ot 2×n cards.

    Divide them into two stacks, one with the first n cards while another with the last n cards.

    Then mix the two stacks of cards uniformly. That is the i-th card of the original stack is placed in the p(i)-th position of the new stack where p(i) is a function defined like this:

    Give you an integer n. Calculate the minimum positive number of shuffles that makes the cards have the same order as the original stack.

    Input

    A line containing an integer n which is less than 109.

    There are multiple test cases. lnput will be terminated by EOF.

    Output

    A line containing an integer which indicates the minimum positive number of shuffles.

    Sample Input

    1

    Sample Output

    2

    Source

    样例输入

    1

    样例输出

    2

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部