Dowemo

Codeforces.

enter n and k, 2k <= n, output 2 * n, each of which isn't identical and <= 2 * n Thinking: first, we look at k = 0. When 2, 1, 4, 3...
A position, the first one. The formula. The value is unchanged, and the value of the next formula decreases 2, so the interpolation becomes 2, so we just exchange k logarithm, the value of the second equation is n
2k, the difference becomes 2 * k.

#include<iostream>


using namespace std;


int main(void)


{


 int n,k;


 cin>>n>>k;


 int flag=0;


 for(int i=1;i<=k;i++)


 {


 if(!flag) cout<<2*i-1<<""<<2*i;


 else cout<<""<<2*i-1<<""<<2*i;


 flag=1; 


 }


 for(int i=k+1;i<=n;i++)


 {


 if(!flag) cout<<2*i<<""<<2*i-1;


 else cout<<""<<2*i<<""<<2*i-1;


 flag=1;


 }


 return 0;


}











Copyright © 2011 Dowemo All rights reserved.    Creative Commons   AboutUs