Home > database >  O answer "poker" c code
O answer "poker" c code

Time:11-10

Title:

Description

Meimei and mountains and decided to play poker, they a total of n (0 & lt; N 100) or less poker, these CARDS were marked as 1, 2,... , n, meimei open poker is the first 1, put it aside. Then move the top two in turn one by one in the end, open the above a, just 2, again aside; Then move the top three in turn one by one in the end, open the above a, is just 3, set aside; . And so it went on, until the last one is n, open on one side, mountains and found that, at this moment, put aside the poker just press 1, 2, 3... N such permutation, he wants to know, in the beginning should be how to discharge these CARDS, to get the result, can you help him to write a program to find the first order of poker?

For example, when n=5, the original permutation is: 1, 4, 5 2, 3; When n=9, the original permutation is: 1, 8 June 2 and 3, 4, 5, 7


Enter

Input format: file has only one line consists of a positive integer n, said the total number of poker,


O

Poker game
Description

Meimei and mountains and decided to play poker, they a total of n (0 & lt; N 100) or less poker, these CARDS were marked as 1, 2,... , n, meimei open poker is the first 1, put it aside. Then move the top two in turn one by one in the end, open the above a, just 2, again aside; Then move the top three in turn one by one in the end, open the above a, is just 3, set aside; . And so it went on, until the last one is n, open on one side, mountains and found that, at this moment, put aside the poker just press 1, 2, 3... N such permutation, he wants to know, in the beginning should be how to discharge these CARDS, to get the result, can you help him to write a program to find the first order of poker?

For example, when n=5, the original permutation is: 1, 4, 5 2, 3; When n=9, the original permutation is: 1, 8 June 2 and 3, 4, 5, 7


Enter

Input format: file has only one line consists of a positive integer n, said the total number of poker,


O
Output format: only one line of output file the original permutation total solution scheme, a total of n number, separated by Spaces in the middle,


Enter the sample 1

5

The output sample 1

1, 4, 5 2, 3,

For the great god code!!!!!
  • Related