#35611: c++


yp11151180@yphs.tp.edu.tw (810-35舒昭齊)

School : 臺北市私立延平高級中學
ID : 197049
IP address : [203.72.178.1]
Last Login :
2023-07-24 14:15:18
e155. 10935 - Throwing cards away I -- UVa 10935 | From: [203.72.178.1] | Post Date : 2023-06-08 17:19

#include <bits/stdc++.h>
using namespace std;

int main(){
    int n;
    while(cin >> n &&  n ){
        queue<int> Q;
        int card[100]={0},end=0;

        for(int i=1;i<=n;i++) Q.push(i);
        cout<<"Discarded cards: ";
        while(Q.size()>1){
            cout<<Q.front();
            if(Q.size()!=2)cout<<", ";
            card[end++]=Q.front();
            Q.pop();
            Q.push(Q.front());
            Q.pop();
        }
        cout<<"\nRemaining card: "<<Q.front()<<'\n';
    }
}

 
#35613: Re: c++


yp11151230@yphs.tp.edu.tw (710-43蔡亞儒)

School : 臺北市私立延平高級中學
ID : 197211
IP address : [203.72.178.1]
Last Login :
2024-05-27 17:43:47
e155. 10935 - Throwing cards away I -- UVa 10935 | From: [203.72.178.1] | Post Date : 2023-06-08 17:25

#include
using namespace std;

int main(){
    int n;
    while(cin >> n &&  n ){
        queue Q;
        int card[100]={0},end=0;

        for(int i=1;i<=n;i++) Q.push(i);
        cout<<"Discarded cards: ";
        while(Q.size()>1){
            cout<            if(Q.size()!=2)cout<<", ";
            card[end++]=Q.front();
            Q.pop();
            Q.push(Q.front());
            Q.pop();
        }
        cout<<"\nRemaining card: "<    }
}



 
#35615: Re: c++


yp11151097@yphs.tp.edu.tw (808-30施耀登)

School : 臺北市私立延平高級中學
ID : 197083
IP address : [203.72.178.1]
Last Login :
2023-06-09 13:54:26
e155. 10935 - Throwing cards away I -- UVa 10935 | From: [203.72.178.1] | Post Date : 2023-06-08 17:30

boo!

 
ZeroJudge Forum