UVA 10935 Throwing cards away

水题

#include<bits/stdc++.h>

int main(void)
{
    int n;
    
    while(cin>>n && n!=0)
    {
        queue<int> q;
        printf("Discarded cards:");
        for(int i=1;i<=n;i++)q.push(i);

        while(q.size() >1)
        {
            printf("%s%d",q.front()==1? " " : ", ",q.front());
            q.pop();
            q.push(q.front());
            q.pop();
        }
        printf("\nRemaining card: %d\n", q.front());
    }

    return 0;
}

 

上一篇:swoole结合php的pdo mysql模式出现MySQL server has gone away


下一篇:mysql导入大批量数据出现MySQL server has gone away的解决方法