fork download
  1. #include <iostream>
  2. #include <cstdint>
  3.  
  4. std::uintmax_t MakeHoge(std::uintmax_t N) {
  5.  
  6. std::uintmax_t R = 1;
  7. if (N == 0) { return 0; }
  8. if (N == 1) { return 1; }
  9. while (N) {
  10. if (N == 3) {
  11. N -= 3;
  12. R *= 3;
  13. }else{
  14. N -= 2;
  15. R *= 2;
  16. }
  17. //n== 1 is R*1=?.
  18. }
  19. return R;
  20. }
  21.  
  22. int main() {
  23.  
  24. for (std::size_t i = 0; i <= 100; i++) {
  25. std::uintmax_t N = MakeHoge(i);
  26. std::cout << i << ':' << N << std::endl;
  27. }
  28.  
  29. return 0;
  30. }
Success #stdin #stdout 0s 4344KB
stdin
Standard input is empty
stdout
0:0
1:1
2:2
3:3
4:4
5:6
6:8
7:12
8:16
9:24
10:32
11:48
12:64
13:96
14:128
15:192
16:256
17:384
18:512
19:768
20:1024
21:1536
22:2048
23:3072
24:4096
25:6144
26:8192
27:12288
28:16384
29:24576
30:32768
31:49152
32:65536
33:98304
34:131072
35:196608
36:262144
37:393216
38:524288
39:786432
40:1048576
41:1572864
42:2097152
43:3145728
44:4194304
45:6291456
46:8388608
47:12582912
48:16777216
49:25165824
50:33554432
51:50331648
52:67108864
53:100663296
54:134217728
55:201326592
56:268435456
57:402653184
58:536870912
59:805306368
60:1073741824
61:1610612736
62:2147483648
63:3221225472
64:4294967296
65:6442450944
66:8589934592
67:12884901888
68:17179869184
69:25769803776
70:34359738368
71:51539607552
72:68719476736
73:103079215104
74:137438953472
75:206158430208
76:274877906944
77:412316860416
78:549755813888
79:824633720832
80:1099511627776
81:1649267441664
82:2199023255552
83:3298534883328
84:4398046511104
85:6597069766656
86:8796093022208
87:13194139533312
88:17592186044416
89:26388279066624
90:35184372088832
91:52776558133248
92:70368744177664
93:105553116266496
94:140737488355328
95:211106232532992
96:281474976710656
97:422212465065984
98:562949953421312
99:844424930131968
100:1125899906842624