0_0_20610525_5506.cpp:5:26: error: stray '#' in program
using namespace std; #define maxn 35 int n, m;int d[maxn];int dir[2] = {-1, 1};bool vis[maxn]; void input(){ char st[5]; scanf("%d", &m); m--; for (int i = 0; i < n; i++) { scanf("%s", st); if (st[0] == 'R') d[i] = 1; else d[i] = 0; }} int unify(int a){ return (a + n) % n;} void work(){ int s = m; int t = unify(0 + dir[d[m]]); if (t == m) t = unify(t + dir[d[m]]); int cnt = 1; int ret = 1; vis[m] = true; memset(vis, 0, sizeof(vis)); while (cnt < n) { vis[s] = true; d[s] = 1 - d[s]; ret++; if (!vis[t]) cnt++; int temp = unify(s + dir[d[t]]); if (temp == t) temp = unify(temp + dir[d[t]]); s = t; t = temp; } printf("Classmate %d got the ball last after %d tosses.\n", s + 1, ret);} int main(){ while (scanf("%d", &n), n) { input(); work(); } return 0;}
^
0_0_20610525_5506.cpp:5:27: error: 'define' does not name a type
using namespace std; #define maxn 35 int n, m;int d[maxn];int dir[2] = {-1, 1};bool vis[maxn]; void input(){ char st[5]; scanf("%d", &m); m--; for (int i = 0; i < n; i++) { scanf("%s", st); if (st[0] == 'R') d[i] = 1; else d[i] = 0; }} int unify(int a){ return (a + n) % n;} void work(){ int s = m; int t = unify(0 + dir[d[m]]); if (t == m) t = unify(t + dir[d[m]]); int cnt = 1; int ret = 1; vis[m] = true; memset(vis, 0, sizeof(vis)); while (cnt < n) { vis[s] = true; d[s] = 1 - d[s]; ret++; if (!vis[t]) cnt++; int temp = unify(s + dir[d[t]]); if (temp == t) temp = unify(temp + dir[d[t]]); s = t; t = temp; } printf("Classmate %d got the ball last after %d tosses.\n", s + 1, ret);} int main(){ while (scanf("%d", &n), n) { input(); work(); } return 0;}
^
0_0_20610525_5506.cpp:5:57: error: 'maxn' was not declared in this scope
using namespace std; #define maxn 35 int n, m;int d[maxn];int dir[2] = {-1, 1};bool vis[maxn]; void input(){ char st[5]; scanf("%d", &m); m--; for (int i = 0; i < n; i++) { scanf("%s", st); if (st[0] == 'R') d[i] = 1; else d[i] = 0; }} int unify(int a){ return (a + n) % n;} void work(){ int s = m; int t = unify(0 + dir[d[m]]); if (t == m) t = unify(t + dir[d[m]]); int cnt = 1; int ret = 1; vis[m] = true; memset(vis, 0, sizeof(vis)); while (cnt < n) { vis[s] = true; d[s] = 1 - d[s]; ret++; if (!vis[t]) cnt++; int temp = unify(s + dir[d[t]]); if (temp == t) temp = unify(temp + dir[d[t]]); s = t; t = temp; } printf("Classmate %d got the ball last after %d tosses.\n", s + 1, ret);} int main(){ while (scanf("%d", &n), n) { input(); work(); } return 0;}
^
0_0_20610525_5506.cpp:5:93: error: 'maxn' was not declared in this scope
using namespace std; #define maxn 35 int n, m;int d[maxn];int dir[2] = {-1, 1};bool vis[maxn]; void input(){ char st[5]; scanf("%d", &m); m--; for (int i = 0; i < n; i++) { scanf("%s", st); if (st[0] == 'R') d[i] = 1; else d[i] = 0; }} int unify(int a){ return (a + n) % n;} void work(){ int s = m; int t = unify(0 + dir[d[m]]); if (t == m) t = unify(t + dir[d[m]]); int cnt = 1; int ret = 1; vis[m] = true; memset(vis, 0, sizeof(vis)); while (cnt < n) { vis[s] = true; d[s] = 1 - d[s]; ret++; if (!vis[t]) cnt++; int temp = unify(s + dir[d[t]]); if (temp == t) temp = unify(temp + dir[d[t]]); s = t; t = temp; } printf("Classmate %d got the ball last after %d tosses.\n", s + 1, ret);} int main(){ while (scanf("%d", &n), n) { input(); work(); } return 0;}
^
0_0_20610525_5506.cpp: In function 'void input()':
0_0_20610525_5506.cpp:5:146: error: 'm' was not declared in this scope
using namespace std; #define maxn 35 int n, m;int d[maxn];int dir[2] = {-1, 1};bool vis[maxn]; void input(){ char st[5]; scanf("%d", &m); m--; for (int i = 0; i < n; i++) { scanf("%s", st); if (st[0] == 'R') d[i] = 1; else d[i] = 0; }} int unify(int a){ return (a + n) % n;} void work(){ int s = m; int t = unify(0 + dir[d[m]]); if (t == m) t = unify(t + dir[d[m]]); int cnt = 1; int ret = 1; vis[m] = true; memset(vis, 0, sizeof(vis)); while (cnt < n) { vis[s] = true; d[s] = 1 - d[s]; ret++; if (!vis[t]) cnt++; int temp = unify(s + dir[d[t]]); if (temp == t) temp = unify(temp + dir[d[t]]); s = t; t = temp; } printf("Classmate %d got the ball last after %d tosses.\n", s + 1, ret);} int main(){ while (scanf("%d", &n), n) { input(); work(); } return 0;}
^
0_0_20610525_5506.cpp:5:181: error: 'n' was not declared in this scope
using namespace std; #define maxn 35 int n, m;int d[maxn];int dir[2] = {-1, 1};bool vis[maxn]; void input(){ char st[5]; scanf("%d", &m); m--; for (int i = 0; i < n; i++) { scanf("%s", st); if (st[0] == 'R') d[i] = 1; else d[i] = 0; }} int unify(int a){ return (a + n) % n;} void work(){ int s = m; int t = unify(0 + dir[d[m]]); if (t == m) t = unify(t + dir[d[m]]); int cnt = 1; int ret = 1; vis[m] = true; memset(vis, 0, sizeof(vis)); while (cnt < n) { vis[s] = true; d[s] = 1 - d[s]; ret++; if (!vis[t]) cnt++; int temp = unify(s + dir[d[t]]); if (temp == t) temp = unify(temp + dir[d[t]]); s = t; t = temp; } printf("Classmate %d got the ball last after %d tosses.\n", s + 1, ret);} int main(){ while (scanf("%d", &n), n) { input(); work(); } return 0;}
^
0_0_20610525_5506.cpp:5:254: error: 'd' was not declared in this scope
using namespace std; #define maxn 35 int n, m;int d[maxn];int dir[2] = {-1, 1};bool vis[maxn]; void input(){ char st[5]; scanf("%d", &m); m--; for (int i = 0; i < n; i++) { scanf("%s", st); if (st[0] == 'R') d[i] = 1; else d[i] = 0; }} int unify(int a){ return (a + n) % n;} void work(){ int s = m; int t = unify(0 + dir[d[m]]); if (t == m) t = unify(t + dir[d[m]]); int cnt = 1; int ret = 1; vis[m] = true; memset(vis, 0, sizeof(vis)); while (cnt < n) { vis[s] = true; d[s] = 1 - d[s]; ret++; if (!vis[t]) cnt++; int temp = unify(s + dir[d[t]]); if (temp == t) temp = unify(temp + dir[d[t]]); s = t; t = temp; } printf("Classmate %d got the ball last after %d tosses.\n", s + 1, ret);} int main(){ while (scanf("%d", &n), n) { input(); work(); } return 0;}
^
0_0_20610525_5506.cpp:5:287: error: 'd' was not declared in this scope
using namespace std; #define maxn 35 int n, m;int d[maxn];int dir[2] = {-1, 1};bool vis[maxn]; void input(){ char st[5]; scanf("%d", &m); m--; for (int i = 0; i < n; i++) { scanf("%s", st); if (st[0] == 'R') d[i] = 1; else d[i] = 0; }} int unify(int a){ return (a + n) % n;} void work(){ int s = m; int t = unify(0 + dir[d[m]]); if (t == m) t = unify(t + dir[d[m]]); int cnt = 1; int ret = 1; vis[m] = true; memset(vis, 0, sizeof(vis)); while (cnt < n) { vis[s] = true; d[s] = 1 - d[s]; ret++; if (!vis[t]) cnt++; int temp = unify(s + dir[d[t]]); if (temp == t) temp = unify(temp + dir[d[t]]); s = t; t = temp; } printf("Classmate %d got the ball last after %d tosses.\n", s + 1, ret);} int main(){ while (scanf("%d", &n), n) { input(); work(); } return 0;}
^
0_0_20610525_5506.cpp: In function 'int unify(int)':
0_0_20610525_5506.cpp:5:336: error: 'n' was not declared in this scope
using namespace std; #define maxn 35 int n, m;int d[maxn];int dir[2] = {-1, 1};bool vis[maxn]; void input(){ char st[5]; scanf("%d", &m); m--; for (int i = 0; i < n; i++) { scanf("%s", st); if (st[0] == 'R') d[i] = 1; else d[i] = 0; }} int unify(int a){ return (a + n) % n;} void work(){ int s = m; int t = unify(0 + dir[d[m]]); if (t == m) t = unify(t + dir[d[m]]); int cnt = 1; int ret = 1; vis[m] = true; memset(vis, 0
|