You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
421 B
C++
18 lines
421 B
C++
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
|
|
int main() {
|
|
int n, cur;
|
|
scanf("%d", &n);
|
|
for (cur = 1; n > 3; n >>= 1, cur <<= 1)
|
|
for (int i = 0; i < (n + 1) >> 1; i++)
|
|
printf("%d ", cur);
|
|
if (n == 1)
|
|
printf("%d\n", cur);
|
|
if (n == 2)
|
|
printf("%d %d\n", cur, cur * 2);
|
|
if (n == 3)
|
|
printf("%d %d %d\n", cur, cur, cur * 3);
|
|
return 0;
|
|
} |