Article From:

Give a set of 1-n, a number of all the numbers in the GCD set, and then choose to delete a number by oneself. Make the dictionary order of the sequence of the number formed by the number maximum.

Idea: All the numbers of GCD must be less than the smallest number in the array, so at first they are all 1. So delete 1 first, then make all the numbers of GCD possible to get 2 quickly.

How to speed up to 2 is to delete all odd numbers, and the smallest remaining number is 2, which is 24,6810…. Delete from 2 at this point.

x ,2x,3x  Only by deleting x 2 x 3 x can the dictionary order x, x, 3x be processed.

(Looks like a lot of people have passed, but they can’t without looking at the problem solving. Mathematics has been forgotten. It’s too good to eat TAT.

using namespace std;
int main(){
  int n;
  int cnt=1;
		  printf("%d %d %d",cnt,cnt,cnt*3);
	  for(int i=1;i<=n/2+n%2;i++){
           printf("%d ",cnt);
	return 0;


Leave a Reply

Your email address will not be published. Required fields are marked *