A. Little Elephant and Function
time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

The Little Elephant enjoys recursive functions.

This time he enjoys the sorting function. Let a is a permutation of an integers from 1 to n, inclusive, and ai denotes the i-th element of the permutation. The Little Elephant's recursive function f(x), that sorts the first x permutation's elements, works as follows:

  • If x = 1, exit the function.
  • Otherwise, call f(x - 1), and then make swap(ax - 1, ax) (swap the x-th and (x - 1)-th elements of a).

The Little Elephant's teacher believes that this function does not work correctly. But that-be do not get an F, the Little Elephant wants to show the performance of its function. Help him, find a permutation of numbers from 1 to n, such that after performing the Little Elephant's function (that is call f(n)), the permutation will be sorted in ascending order.

Input

A single line contains integer n (1 ≤ n ≤ 1000) — the size of permutation.

Output

In a single line print n distinct integers from 1 to n — the required permutation. Numbers in a line should be separated by spaces.

It is guaranteed that the answer exists.

Examples
input
1
output
1 
input
2
output
2 1 

题意:输出那个程序的执行结果

 #include<cstdio>
using namespace std;
int main()
{
int n;
scanf("%d",&n);
printf("%d ",n);
for(int i=;i<n;i++) printf("%d ",i);
}

Codeforces 221 A. Little Elephant and Function的更多相关文章

  1. Codeforces 221 E. Little Elephant and Shifts

    E. Little Elephant and Shifts time limit per test 2 seconds memory limit per test 256 megabytes inpu ...

  2. Codeforces 221 D. Little Elephant and Array

    D. Little Elephant and Array time limit per test 4 seconds memory limit per test 256 megabytes input ...

  3. Codeforces 221 C. Little Elephant and Problem

    C. Little Elephant and Problem time limit per test 2 seconds memory limit per test 256 megabytes inp ...

  4. Codeforces 221 B. Little Elephant and Numbers

    B. Little Elephant and Numbers time limit per test 2 seconds memory limit per test 256 megabytes inp ...

  5. AC日记——Little Elephant and Function codeforces 221a

    A - Little Elephant and Function 思路: 水题: 代码: #include <cstdio> #include <iostream> using ...

  6. Codeforces 221d D. Little Elephant and Array

    二次联通门 : Codeforces 221d D. Little Elephant and Array /* Codeforces 221d D. Little Elephant and Array ...

  7. Educational Codeforces Round 13 D. Iterated Linear Function 水题

    D. Iterated Linear Function 题目连接: http://www.codeforces.com/contest/678/problem/D Description Consid ...

  8. Educational Codeforces Round 13 D. Iterated Linear Function (矩阵快速幂)

    题目链接:http://codeforces.com/problemset/problem/678/D 简单的矩阵快速幂模版题 矩阵是这样的: #include <bits/stdc++.h&g ...

  9. 【Codeforces 204E】Little Elephant and Strings

    Codeforces 204 E 题意:给\(n\)个串,求对于每一个串在至少\(k\)个串中出现的它的子串\(S_{l..r}\)有多少个. 思路:后缀自动机上\(dp\)... 我们首先构造出这\ ...

随机推荐

  1. mysql You can't specify target table 'xxx' for update in FROM clause

    含义:您不能在子句中为更新指定目标表'xxx'. 错误描述:删除语句中直接含select,如下: DELETE FROM meriadianannotation WHERE SeriesID IN ( ...

  2. HDU 5179 beautiful number 数位dp

    题目链接: hdu: http://acm.hdu.edu.cn/showproblem.php?pid=5179 bc(中文): http://bestcoder.hdu.edu.cn/contes ...

  3. CDN加速-内容分发网络

    内容分发网络 (互联网技术) 编辑 CDN的全称是Content Delivery Network,即内容分发网络.其基本思路是尽可能避开互联网上有可能影响数据传输速度和稳定性的瓶颈和环节,使内容传输 ...

  4. 第134天:移动web开发的一些总结(二)

    1.响应式布局 开发一个页面,在所有的设备上都能够完美展示. 媒体查询:@media screen and (max-width:100px) { } 媒体类型:screen(屏幕) print(打印 ...

  5. 【数据库】Mysql更改默认引擎为Innodb的步骤方法

    前言 InnoDB和MyISAM是许多人在使用MySQL时最常用的两个表类型,这两个表类型各有优劣,视具体应用而定. 基本的差别为:MyISAM类型不支持事务处理等高级处理,而InnoDB类型支持.M ...

  6. 【三】shiro入门 之 Realm

    Realm:域,Shiro 从从Realm获取安全数据(如用户.角色.权限),就是说SecurityManager要验证用户身份,那么它需要从Realm获取相应的用户进行比较以确定用户身份是否合法:也 ...

  7. Contest 6

    A:容易发现这要求所有子集中元素的最高位1的位置相同,并且满足这个条件也是一定合法的.统计一下即可. #include<iostream> #include<cstdio> # ...

  8. spring的事务传播特性

    PROPAGATION_REQUIRED(常用) Support a current transaction; create a new one if none exists.  支持一个当前事务;如 ...

  9. Best Reward HDU - 3613(马拉车+枚举+前缀和)

    题意: 给你一串字符串,每个字符都有一个权值,要求把这个字符串在某点分开,使之成为两个单独的字符串 如果这两个子串某一个是回文串,则权值为那一个串所有的字符权值和 若不是回文串,则权值为0 解析: 先 ...

  10. 【刷题】洛谷 P3796 【模板】AC自动机(加强版)

    题目描述 有 \(N\) 个由小写字母组成的模式串以及一个文本串 \(T\) .每个模式串可能会在文本串中出现多次.你需要找出哪些模式串在文本串 \(T\) 中出现的次数最多. 输入输出格式 输入格式 ...