-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathPOJ1012(AC).cpp
71 lines (66 loc) · 1.1 KB
/
POJ1012(AC).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
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
/*
int main()
{
int f[100];
int n, c, cc, left_cc;
int m, i, this_i;
while(scanf("%d", &n) == 1 && n){
n *= 2;
for(m = n / 2 + 1; ; ++m){
if(m % (n / 2 + 1) != 0 && m % (n / 2 + 1) != 1){
continue;
}
memset(f, 0, 100 * sizeof(int));
cc = 0;
left_cc = n;
i = 0;
while(cc < n / 2){
c = 1;
if(!(left_cc = m % (n - cc))){
left_cc = n - cc;
}
while(true){
if(!f[i]){
if(c == left_cc){
this_i = i;
f[i] = 1;
i = (i + 1) % n;
break;
}else{
++c;
i = (i + 1) % n;
}
}else{
i = (i + 1) % n;
}
}
if(this_i >= 0 && this_i <= n / 2 - 1){
break;
}else{
--left_cc;
++cc;
}
}
if(cc == n / 2){
break;
}
}
printf("%d\n", m);
}
return 0;
}
*/
int main()
{
int a[15] = {0, 2, 7, 5, 30, 169, 441, 1872, 7632, 1740, 93313, 459901, 1358657, 2504881, 13482720};
int n;
while(scanf("%d", &n) == 1 && n){
printf("%d\n", a[n]);
}
return 0;
}