codeforces 315B
#include<stdio.h>
int main() {
int n,k,i,flag=0;
while(scanf("%d%d",&n,&k)!=EOF) {
flag=0;
for(i=1;i<=k;i++) {
if(flag==0) {
flag=1;
printf("%d %d",2*i-1,2*i);
}
else
printf(" %d %d",2*i-1,2*i);
}
for(i=k+1;i<=n;i++) {
if(flag==0) {
flag=1;
printf("%d %d",2*i,2*i-1);
}
else
printf(" %d %d",2*i,2*i-1);
}
printf("\n");
}
return 0;
}
codeforces 315B的更多相关文章
- Sereja and Array-数组操作或者线段树或树状数组
CodeForces - 315B Sereja and Array Time Limit: 1000MS Memory Limit: 262144KB 64bit IO Format: %I ...
- python爬虫学习(5) —— 扒一下codeforces题面
上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...
- 【Codeforces 738D】Sea Battle(贪心)
http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n g ...
- 【Codeforces 738C】Road to Cinema
http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants ...
- 【Codeforces 738A】Interview with Oleg
http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interv ...
- CodeForces - 662A Gambling Nim
http://codeforces.com/problemset/problem/662/A 题目大意: 给定n(n <= 500000)张卡片,每张卡片的两个面都写有数字,每个面都有0.5的概 ...
- CodeForces - 274B Zero Tree
http://codeforces.com/problemset/problem/274/B 题目大意: 给定你一颗树,每个点上有权值. 现在你每次取出这颗树的一颗子树(即点集和边集均是原图的子集的连 ...
- CodeForces - 261B Maxim and Restaurant
http://codeforces.com/problemset/problem/261/B 题目大意:给定n个数a1-an(n<=50,ai<=50),随机打乱后,记Si=a1+a2+a ...
- CodeForces - 696B Puzzles
http://codeforces.com/problemset/problem/696/B 题目大意: 这是一颗有n个点的树,你从根开始游走,每当你第一次到达一个点时,把这个点的权记为(你已经到过不 ...
随机推荐
- c++ 如何对拍
首先要写好两个要对拍程序(假设是A,B),和一个制造数据的程序(设为made) (要放在同一文件夹内) 编译得到A.exe , B.exe , made.exe 写一个对拍器 格式如下 @ech ...
- 【前端】jQurey Plugin
; (function ($, window, document, undefined) { "use strict"; var defaults = { name: " ...
- python实战之爬取喜玛拉雅专辑信息
import urllib.request import json from lxml import etree url='http://www.ximalaya.com/dq/8.ajax' hea ...
- slimScroll的应用(一)
本类文章依旧是针对初学者来说的,希望大家看到后觉得有用的能给个赞~~ 什么是slimScroll? 一.官网介绍: slimScroll is a small (4.6KB) jQuery plugi ...
- [Java 8] (9) Lambda表达式对递归的优化(下) - 使用备忘录模式(Memoization Pattern) .
使用备忘录模式(Memoization Pattern)提高性能 这个模式说白了,就是将需要进行大量计算的结果缓存起来,然后在下次需要的时候直接取得就好了.因此,底层只需要使用一个Map就够了. 但是 ...
- SPOJ COT2 Count on a tree II (树上莫队,倍增算法求LCA)
题意:给一个树图,每个点的点权(比如颜色编号),m个询问,每个询问是一个区间[a,b],图中两点之间唯一路径上有多少个不同点权(即多少种颜色).n<40000,m<100000. 思路:无 ...
- dockerfile 的最佳实践
Dockerfile 编写nginx容器 [root@mast nginx]# cat Dockerfile FROM centos MAINTAINER zhaoruidong RUN yum -y ...
- 样式化复选框(Styling Checkbox)
原理:https://www.tuicool.com/articles/y67jee 表现:http://www.freejs.net/demo/381/index.html https://www. ...
- Caused by: java.lang.ClassNotFoundException: Cannot find class: User
源代码: <select id="selectAll" resultType="User"> select user_id uid,user_nam ...
- 第1节 flume:9、flume的多个agent串联(级联)
3.两个agent级联 需求分析: 第一个agent负责收集文件当中的数据,通过网络发送到第二个agent当中去,第二个agent负责接收第一个agent发送的数据,并将数据保存到hdfs上面去 第一 ...