Java solution method for a Micro-surface test (2)

zhaozj2021-02-16  55

/ * * An ordered number of columns, each value in the sequence can be divided by 2 or 3 or 5, * 1 is the first element of this sequence. What is the 1500 value?

* This topic uses a very stupid method when interview. It's really awkward. Ha ha! :)

* This class is used to calculate the value of the nth element of this sequence. * / Package bia.arithmetic; import java.util.date;

/ ** * @Author renzhichao * / public class next minutes {

/ ** * * / public nextItem () {super (); // Todo auto-generated constructor stub array [0] = 1; POSX = 0; POSY = 0; POSZ = 0; itempos = 0; CAL (); }

Void Cal () {Valx = 2 * Array [POSX]; Valy = 3 * array [POSY]; VALZ = 5 * array [POSZ];

Long array [] = new long [1500]; int POSX, POSY, POSZ; Long Valx, VALY, VALZ; INT ITEMPOS

/ ** * Calculate the next element in the sequence * @Renzhichao * * / public void nextItem () {long min = valX; boolean flagx = false; boolean flagy = false; boolean flagz = false; if (Valy array [itempos]) {Itempos ; array [itempos] = min; if (flagx) POSX ; if (flagy) POSY ; f (flagz) POSZ ;} Cal ();}

转载请注明原文地址:https://www.9cbs.com/read-27363.html

New Post(0)