Time limit  1000 ms

Memory limit  131072 kB

Little A has became fascinated with the game Dota recently, but he is not a good player. In all the modes, the rdsp Mode is popular on online, in this mode, little A always loses games if he gets strange heroes, because, the heroes are distributed randomly.

Little A wants to win the game, so he cracks the code of the rdsp mode with his talent on programming. The following description is about the rdsp mode:

There are N heroes in the game, and they all have a unique number between 1 and N. At the beginning of game, all heroes will be sorted by the number in ascending order. So, all heroes form a sequence One.

These heroes will be operated by the following stages M times:

1.Get out the heroes in odd position of sequence One to form a new sequence Two;

2.Let the remaining heroes in even position to form a new sequence Three;

3.Add the sequence Two to the back of sequence Three to form a new sequence One.

After M times' operation, the X heroes in the front of new sequence One will be chosen to be Little A's heroes. The problem for you is to tell little A the numbers of his heroes.

Input

There are several test cases.
Each case contains three integers N (1<=N<1,000,000), M (1<=M<100,000,000), X(1<=X<=20).
Proceed to the end of file.


Output

For each test case, output X integers indicate the number of heroes. There is a space between two numbers. The output of one test case occupied exactly one line.


Sample Input

5 1 2
5 2 2

Sample Output

2 4
4 3

Hint

In case two: N=5,M=2,X=2,the initial sequence One is 1,2,3,4,5.After the first operation, the sequence One
is 2,4,1,3,5. After the second operation, the sequence One is 4,3,2,1,5.So,output 4 3. 题意是每次操作都会把偶数位置的数提出放到最前面来,然后操作次数很大,求操作后的序列前几位 先看一下我傻逼一样的超时代码
 #include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std; struct node
{
int num;
int id;
}a[]; bool cmp(node b,node c)
{
return b.id<c.id;
} int main()
{
int n,m,k;
int i,j;
while(~scanf("%d%d%d",&n,&m,&k))
{
for(i=;i<=n;i++)
{
a[i].num=i;
a[i].id=i;
}
//找循环结
bool flag=true;
for(i=;i<=m;i++)
{
for(j=;j<=n;j+=)
a[j].id/=;
for(j=;j<=n;j+=)
a[j].id=(a[j].id+)/+n/;
sort(a+,a++n,cmp);
flag=true;
for(j=;j<=n;j++)
{
if(a[j].num!=j)
{
flag=false;
break;
}
}
if(flag)
break;
}
//取余
if(m!=i-)
{
m%=i;
//最后操作
for(i=;i<=n;i++)
{
a[i].num=i;
a[i].id=i;
}
for(i=;i<=m;i++)
{
for(j=;j<=n;j+=)
a[j].id/=;
for(j=;j<=n;j+=)
a[j].id=(a[j].id+)/+n/;
sort(a+,a++n,cmp);
}
printf("%d",a[].num);
for(i=;i<=k;i++)
printf(" %d",a[i].num);
printf("\n");
}
else
{
printf("%d",a[].num);
for(i=;i<=k;i++)
printf(" %d",a[i].num);
printf("\n");
}
}
return ;
}
再看一下我们女队楼主的超强代码
 #include <iostream>
#include<stdio.h>
using namespace std;
#define maxn 1000000
int n;
int ci;
int a[maxn+];
int k;
int T(int x)
{
int c=;
int cnt=;
do{
if(c*<=n)
{
c*=;
}
else
{
c=(c-n/)*-;
}
cnt++;
}while(c!=);
return cnt;
}
int main()
{
while(~scanf("%d%d%d",&n,&ci,&k))
{
ci%=T(n);
for(int i=;i<=n;i++)a[i]=i;
for(int i=;i<=k;i++)
{ for(int j=;j<=ci;j++)
{
if(a[i]*<=n)
{
a[i]=*a[i];
}
else{
a[i]=(a[i]-n/)*-;
}
}
if(i==)cout<<a[i];
else cout<<" "<<a[i];
}
cout<<endl; }
return ;
52 }

所以我是不是个傻逼。。。

是。。


NBUT 1225 NEW RDSP MODE I 2010辽宁省赛的更多相关文章

  1. NBUT 1218 You are my brother 2010辽宁省赛

    Time limit 1000 ms Memory limit 131072 kB Little A gets to know a new friend, Little B, recently. On ...

  2. NBUT 1225 NEW RDSP MODE I

    找出循环周期即可了 #include<bits/stdc++.h> using namespace std; int N,M,X; int time(int x,int y,int z) ...

  3. NBUT 1221 Intermediary 2010辽宁省赛

    Time limit 1000 ms Memory limit 131072 kB It is widely known that any two strangers can get to know ...

  4. NBUT 1224 Happiness Hotel 2010辽宁省赛

    Time limit 1000 ms Memory limit 131072 kB The life of Little A is good, and, he managed to get enoug ...

  5. NBUT 1222 English Game 2010辽宁省赛

    Time limit 1000 ms Memory limit 131072 kB This English game is a simple English words connection gam ...

  6. NBUT 1220 SPY 2010辽宁省赛

    Time limit  1000 ms Memory limit  131072 kB The National Intelligence Council of X Nation receives a ...

  7. NBUT 1219 Time 2010辽宁省赛

    Time limit   1000 ms Memory limit   131072 kB Digital clock use 4 digits to express time, each digit ...

  8. NBUT 1223 Friends number 2010辽宁省赛

    Time limit  1000 ms Memory limit   131072 kB Paula and Tai are couple. There are many stories betwee ...

  9. NBUT 1217 Dinner 2010辽宁省赛

    Time limit  1000 ms Memory limit  32768 kB Little A is one member of ACM team. He had just won the g ...

随机推荐

  1. Qt5_QString_测试

    ZC: 下面的测试效果看,可以只是用 “QString.isEmpty()” 或者 “QString == ""”来判断 QString是否为 空或者NULL . 1. 1.1. ...

  2. 从996到ICU——我们终将被自我厌恶

    自从996.icu在github上收获了18万点赞以来,超时工作,超负荷劳动似乎成了天下所有“无产阶级者”的共同点.对于这样的剥削制度,我想再多的批评和抨击都不为过.但是今天我想说3个小故事,只为引起 ...

  3. hdu 5724-Chess(状态压缩+sg函数)

    hdu 5724-Chess 代码: #include<bits/stdc++.h> using namespace std; ; <<N]; bool S[N]; void ...

  4. 敏感性、特异性、假阳性、假阴性(sensitivity and specificity)

    医学.机器学习等等,在统计结果时时长会用到这两个指标来说明数据的特性. 定义 敏感性:在金标准判断有病(阳性)人群中,检测出阳性的几率.真阳性.(检测出确实有病的能力) 特异性:在金标准判断无病(阴性 ...

  5. English trip -- VC(情景课)1 C What's your name?(review)

    Xu言: 今天,阴差阳错又上了一次 VC 1 C的课,不过这次是小班的形式.这次课的教室叫 toronto   [təˈrɒntəʊ]  to ron to (多伦多(加拿大城市))   - -0我还 ...

  6. php--------使用js生成二维码

    php生成二维码有多种方式,可以在JS中,也可以使用php库,今天写的这个小案例是使用JS生成二维码. 其他方式可以看下一篇文章:php--------php库生成二维码和有logo的二维码 网站开发 ...

  7. string类的用法笔记

    要想使用标准C++中string类,必须要包含 #include <string>// 注意是<string>,不是<string.h>,带.h的是C语言中的头文件 ...

  8. 关于一些逗逼函数//atoi,itoa,strtok,strupr,

    reverse(begin,end)  反转容器内容可以是string,char数组,也可以是int型数组...用于反转其中的内容: char *   strtok(cahr *,const char ...

  9. ASP.NET的路由系统

    一.URL与物理文件的分离 1.URL与物理文件的分离 对于一个 ASP.NET Web Form应用来说,任何一个请求都对应着某个具体的物理文件.部署在Web服务器上的物理文件可以是静态的(比如图片 ...

  10. PHP:第三章——PHP中表达式函数和匿名函数

    <?php header("Content-Type:text/html;charset=utf-8"); //表达式函数和匿名函数 /*$A=function(){ ech ...