#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std; int a[];
int main()
{
int n,k;
scanf("%d%d",&n,&k);
for(int i=; i<=*n; i++)
{
a[i]=i;
}
for(int i=; i<=k; i++)
{
swap(a[*i-],a[*i]);
}
for(int i=; i<=*n; i++)
{
if(i==) printf("%d",a[i]);
else printf(" %d",a[i]);
}
printf("\n");
return ;
}

http://codeforces.com/contest/359/problem/B

 #include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std; int n,k; int main()
{
while(scanf("%d%d",&n,&k)!=EOF)
{
printf("%d",k+);
for(int i=; i<=*n; i++)
{
if(i!=k+) printf(" %d",i);
}
printf("\n");
}
return ;
}

cf B. Permutation的更多相关文章

  1. CF数据结构练习

    1. CF 438D The Child and Sequence 大意: n元素序列, m个操作: 1,询问区间和. 2,区间对m取模. 3,单点修改 维护最大值, 取模时暴力对所有>m的数取 ...

  2. Good Triple CodeForces - 1169D (等差子序列)

    大意: 给定01字符串, 求有多少个区间$[l,r]$, 使得存在正整数$x,k$满足$1\le x,k\le n,l\le x<x+2k\le r,s_x=s_{x+k}=s_{x+2k}$. ...

  3. CF 500 B. New Year Permutation 并查集

    User ainta has a permutation p1, p2, ..., pn. As the New Year is coming, he wants to make his permut ...

  4. CF&&CC百套计划3 Codeforces Round #204 (Div. 1) E. Jeff and Permutation

    http://codeforces.com/contest/351/problem/E 题意: 给出一些数,可以改变任意数的正负,使序列的逆序对数量最少 因为可以任意加负号,所以可以先把所有数看作正数 ...

  5. CF 1033 C. Permutation Game

    C. Permutation Game http://codeforces.com/contest/1033/problem/C 题意: 一个排列,每个位置i走到的位置j满足:a[j]>a[i] ...

  6. [CF 612E]Square Root of Permutation

    A permutation of length n is an array containing each integer from 1 to n exactly once. For example, ...

  7. CF 1141C Polycarp Restores Permutation

    Description An array of integers p1,p2,…,pnp1,p2,…,pn is called a permutation if it contains each nu ...

  8. CF R 209 div 2 CF359B Permutation 构造

    LINK:Permutation 休闲一下 开了一道构造题. 看起来毫无头绪 其实仔细观察第二个条件 0<=2k<=n. 容易想到当n是奇数的时候 k的范围更小 再手玩一下第一个条件 容易 ...

  9. cf B. Levko and Permutation

    http://codeforces.com/contest/361/problem/B #include <cstdio> #include <cstring> #includ ...

随机推荐

  1. MFC中DoDataExchange()的作用

    void CDlgSelectCS::DoDataExchange(CDataExchange* pDX) {     CDialog::DoDataExchange(pDX);     DDX_Te ...

  2. 【HDOJ】1315 Basic

    这道题目巨坑啊,注意__int64,int wa了一个下午. #include <cstdio> #include <cstring> #include <cstdlib ...

  3. css实现居中的各种方法

    css垂直居中有很多种方法,可以参考下这个网站

  4. zabbix流量汇聚

    "服务器流量汇总"领导提需求,要把几个数据中心的数据汇总起来,于是就google了一下"zabbix流量汇总" 按照其中一篇博客做了出来,博客地址如下. htt ...

  5. 关于javax.crypto.BadPaddingException: Blocktype错误的几种解决方法

    此文章转载自:http://www.myexception.cn/mobile/1259076.html 关于javax.crypto.BadPaddingException: Blocktype异常 ...

  6. C++ lambda 表达式传递的变量默认不可变

    我遇到例如以下问题: int count=0; listener->onTouchMoved=[count](Touch* t,Event* e){ count++; log("onT ...

  7. 【Spring MVC系列】--(5)理解AOP

    1.java反射 实用:JAVA反射机制及应用例子 http://407827531.iteye.com/blog/1173930 系统:java反射原理 http://china-jianchen. ...

  8. solr 3.5 配置及server设置

    一.solr 的简单介绍 Apache Solr 是一个开源的搜索server.Solr 使用 Java 语言开发,主要基于 HTTP 和 Apache Lucene 实现.Apache Solr 中 ...

  9. Ignatius and the Princess III --undo

    Ignatius and the Princess III Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 65536/32768K (J ...

  10. linux下查阅文件内容cat,more,less,tail

    1.常用cat,直接查看,一次性全部输出 cat  filename cat -b filename 显示行号,除空白行   cat -n 显示行号,包括空白行 常用:cat  filename | ...