您当前的位置: 首页 >  网络

梁同学与Android

暂无认证

  • 5浏览

    0关注

    618博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

2019中国大学生程序设计竞赛(CCPC)-网络选拔赛-第七题Shuffle Card

梁同学与Android 发布时间:2019-08-29 20:06:48 ,浏览量:5

文章目录
    • 1.大赛题目
    • 2.中文翻译
    • 3.代码案例
    • 4.解题思路
      • 4.1代码举例

1.大赛题目

Shuffle Card Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 6695 Accepted Submission(s): 2061

Problem Description A deck of card consists of n cards. Each card is different, numbered from 1 to n. At first, the cards were ordered from 1 to n. We complete the shuffle process in the following way, In each operation, we will draw a card and put it in the position of the first card, and repeat this operation for m times.

Please output the order of cards after m operations.

Input The first line of input contains two positive integers n and m.(1= 0; i--) { if(Ex[B[i]]==0) { out[count++] = B[i]; //这里Ex[B[i]]等于几都可以,只要不等于0 Ex[B[i]] = 1; } }

Ex[3] = 0->out[1] = 3->Ex[3] = 1 Ex[4] = 0->out[2] = 4->Ex[4] = 1 Ex[3] = 1 ->结束循环

for(int i = 0;iout[3] = 1 Ex[2] = 0->out[4] = 2 Ex[3] = 1 Ex[4] = 1 Ex[5] = 0->out[5] = 5

关注
打赏
1660730345
查看更多评论
0.1228s