-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path10935 - Throwing cards away I.cpp
118 lines (93 loc) · 2.8 KB
/
10935 - Throwing cards away I.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/**********************************************************************
* BISMILLAHIR RAHMANIR RAHIM *
* *
* "There's a benefit to losing, you get to learn from your mistakes" *
* *
* UVa: 10935 - Throwing cards away I *
**********************************************************************/
#include<bits/stdc++.h>
using namespace std;
#define si(x) scanf("%d",&x)
#define sii(x,y) scanf("%d %d",&x,&y)
#define siii(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define sl(x) scanf("%lld",&x)
#define sll(x,y) scanf("%lld %lld",&x,&y)
#define slll(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define ss(ch) scanf("%s",ch)
#define chr getchar()
#define pi(x) printf("%d",x)
#define pii(x,y) printf("%d %d",x,y)
#define pl(x) printf("%lld",x)
#define pll(x,y) printf("%lld %lld",x,y)
#define ps(ch) printf("%s",ch)
#define pc(ch) printf("%c",ch)
#define sf scanf
#define pf printf
#define pcs(x,y) printf("Case %d: %s", x, y)
#define pci(x,y) printf("Case %d: %d", x, y)
#define NL printf("\n")
#define nl '\n'
#define debug(x) printf("Debug %d !!\n",x)
#define mod 1000000007
#define FI freopen("in.txt","r",stdin)
#define FO freopen("out.txt","w",stdout)
#define FOR(i,j,k) for(i = j; i < k; i++)
#define rep(l,n) FOR(l,0,n)
#define REV(i,j,k) for(i = j; i > k; i--)
#define PI acos(-1.0)
#define INF_MAX 2147483647
#define INF_MIN -2147483647
#define pb(x) push_back(x)
#define ppb() pop_back()
#define sz(x) x.size()
#define xx first
#define yy second
#define mem(ara,val) memset(ara,val,sizeof(ara))
#define clr(ara) mem(ara,0)
#define st(ara) mem(ara,-1)
#define ssz(a) strlen(a)
#define eps 1e-9
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef pair<int,int> PII;
typedef vector< PII > VII;
//#define CFw
const int siz = 2000000 + 10;
int main(){
//std::ios_base::sync_with_stdio(0);
#ifdef CFw
while(1){
#endif
//FI;FO;
int t, z = 0, l, i, m, len;
int n;
VI in, ans;
while(si(n) && n){
in.clear();
ans.clear();
FOR(l, 1, n + 1) in.pb(l);
while(sz(in) != 1){
ans.pb(in.front());
in.erase(in.begin() + 0);
m = in.front();
in.erase(in.begin() + 0);
in.pb(m);
}
ps("Discarded cards:");
rep(l,sz(ans)){
if(l) ps(",");
ps(" ");
pi(ans[l]);
}
NL;
ps("Remaining card: ");
pi(in.front());
NL;
}
#ifdef CFw
NL;
}
#endif
return 0;
}