fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10.  
  11. static final int M = 1000000007;
  12. public static void main (String[] args) throws java.lang.Exception
  13. {
  14. for(int i = 0; i < 100; i++)
  15. {
  16. System.out.println(i + ": " + groupsoftwo(i));
  17. }
  18. }
  19. static long groupsoftwo(long x)
  20. {
  21. if((x == 0)||(x == 1))
  22. {
  23. return 0;
  24. }
  25. long f=1;
  26. long pow = x/2;
  27.  
  28. for(long i = (pow+1), j = (pow+1); i <= x; i++)
  29. {
  30. j = i;
  31. while(((j%2)==0) && pow>0)
  32. {
  33. j /= 2;
  34. pow--;
  35. }
  36. f = (f*j)%M;
  37.  
  38. }
  39.  
  40.  
  41. return f;
  42.  
  43. }
  44. }
Success #stdin #stdout 0.04s 2184192KB
stdin
Standard input is empty
stdout
0: 0
1: 0
2: 1
3: 3
4: 3
5: 15
6: 15
7: 105
8: 105
9: 945
10: 945
11: 10395
12: 10395
13: 135135
14: 135135
15: 2027025
16: 2027025
17: 34459425
18: 34459425
19: 654729075
20: 654729075
21: 749310484
22: 749310484
23: 234141013
24: 234141013
25: 853525290
26: 853525290
27: 45182669
28: 45182669
29: 310297394
30: 310297394
31: 619219151
32: 619219151
33: 434231843
34: 434231843
35: 198114400
36: 198114400
37: 330232751
38: 330232751
39: 879077205
40: 879077205
41: 42165153
42: 42165153
43: 813101572
44: 813101572
45: 589570488
46: 589570488
47: 709812747
48: 709812747
49: 780824365
50: 780824365
51: 822042342
52: 822042342
53: 568243825
54: 568243825
55: 253410158
56: 253410158
57: 444378908
58: 444378908
59: 218355390
60: 218355390
61: 319678699
62: 319678699
63: 139757897
64: 139757897
65: 84263242
66: 84263242
67: 645637179
68: 645637179
69: 548965043
70: 548965043
71: 976517787
72: 976517787
73: 285797954
74: 285797954
75: 434846403
76: 434846403
77: 483172800
78: 483172800
79: 170650934
80: 170650934
81: 822725563
82: 822725563
83: 286221253
84: 286221253
85: 328806337
86: 328806337
87: 606151123
88: 606151123
89: 947449576
90: 947449576
91: 217910814
92: 217910814
93: 265705562
94: 265705562
95: 242028215
96: 242028215
97: 476736694
98: 476736694
99: 196932377