卡片游戏

#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
const int MAXN = 50;
int queue[MAXN];
int main()
{
    int n,front,rear;
    scanf_s("%d",&n,sizeof(n));
    for(int i = 0; i < n; i++)
        queue[i] = i+1;
    front = 0, rear = n;
    while(front < rear)
    {
        printf("%d",queue[front++]);
        queue[rear++] = queue[front++];
    }
    system("pause");
    return 0;

 

posted @ 2015-04-17 09:06  码农@163  阅读(125)  评论(0编辑  收藏  举报