Topic
n a different number to satisfy its LCM.
We take the LCM as a line segment and divide it into n parts of different lengths.
Of course there are a lot of different methods, we only need to construct a good to write.
Divide it into two one-second, take one of one-second and divide it into 1/3 and 2/3, and then each take 1/3 to 1/3 and 2/3.
1
1/2 1/2
1/2 2/6 1/6
1/2 2/6 2/18 1/18
The shortest is 1/18 of this, we make it 1. The other lengths can be calculated: 9 6 2 1.
So the shortest two, then each number is the sum of the preceding number twice times, the last number is the sum of all the preceding numbers.
A little longer: 1 2 6 18 54 81
It can be found that the first two numbers are 1, 2, followed by 3 times times the previous number, the last number is 3 n-2.
Make $a[0]=1,a[i]=2*3^{i-1}$ < Span class= "Mjx-char mjxc-tex-main-r" >< Span id= "mjxc-node-24" class= "Mjx-mo" > is written in a large integer class of Java and is relatively thin.
Import java.io.*;import java.math.*;import java.util.*;p ublic class main{ //a[i]=1 2 6 162 static Bigintege R a[]=new biginteger[250]; public static void Main (string[] args) { Scanner cin= new Scanner (system.in); A[0]=biginteger.valueof (1); A[1]=biginteger.valueof (2); for (int i=2;i<=200;i++) a[i]=a[i-1].multiply (biginteger.valueof (3)); int T=cin.nextint (); for (int i=1;i<=t;i++) { int n=cin.nextint (); if (n==2) System.out.println ( -1); else{for (int j=0;j<n-1;j++) System.out.println (A[j]); System.out.println (A[n-1].divide (biginteger.valueof (2));}}}}
"Openj_poj c16d" extracurricular Sports (construction, law-seeking)