Home > Back-end >  fission
fission

Time:02-06

Bosses, what is the subject of their thinking, I want to define the square on the loop please

CodePudding user response:

The topic request is not clear?
Enter a positive number n, and then judge n how many times have greater than or equal to 10000, 00000, this is how much power of the solution,
Such as a person up to eight people, to be passed on to 100 people, so,
For the first time, to eight people, that is, 1 of 8 square
Second, the eight everyone again to the other eight people, also is the square of 8 * 8=64=8, only 64 people know at this time, still not meet 100 people, so you need to continue to spread
Third, this 64 people each person to the other eight people, or 64 * 8=512=8 cubic, there are 512 people know, meet 100 people, so you need to spread 3
The code example
Int main () {
Int n, m, p, q;
The scanf (" % d % d ", & amp; N, & amp; M);
For (q=1, p=n; pPrintf (" need to spread % d times ", q);
return 0;
}

CodePudding user response:

reference 1st floor qybao response:
the topic request is not clear?
Enter a positive number n, and then judge n how many times have greater than or equal to 10000, 00000, this is how much power of the solution,
Such as a person up to eight people, to be passed on to 100 people, so,
For the first time, to eight people, that is, 1 of 8 square
Second, the eight everyone again to the other eight people, also is the square of 8 * 8=64=8, only 64 people know at this time, still not meet 100 people, so you need to continue to spread
Third, this 64 people each person to the other eight people, or 64 * 8=512=8 cubic, there are 512 people know, meet 100 people, so you need to spread 3
The code example
Int main () {
Int n, m, p, q;
The scanf (" % d % d ", & amp; N, & amp; M);
For (q=1, p=n; pPrintf (" need to spread % d times ", q);
return 0;
}

Ah! Got it, thank you??

CodePudding user response:

With geometric series summation formula:
Int n=8, m=1000000000;
Printf (" % d \ n ", (int) ceil (log ((double) m * (n - 1) + 1)/log (n) (double)));

CodePudding user response:

reference movsd reply: 3/f
with geometric series summation formula:
Int n=8, m=1000000000;
Printf (" % d \ n ", (int) ceil (log ((double) m * (n - 1) + 1)/log (n) (double)));

Ceil is what mean bosses

CodePudding user response:

Ceil mean ceiling
Floating - Point Support
Many Microsoft run - time library functions provides the require floating - point support from a math coprocessor or from the floating - point libraries that accompany the compiler. The floating - point support functions provides all the loaded only if required.

When you use a floating - point type specifiers in the format string of a call to a function in the printf or the scanf family, you must specify a floating - point value or a pointer to a floating - point value in the argument list to tell the compiler that floating - point support is required. The math functions provides in the Microsoft run - time library handle exceptions the same way that the UNIX V math functions provides the do.

The Microsoft run - time library sets The default internal precision of The math coprocessor (or emulator) to 64 bits. This default applies only to The internal precision at which all intermediate calculations are performed. It does not apply to the size of the arguments and return values, or variables. You can override this default and set the chip (or emulator) back to 80 - bit precision by linking your program with LIB/FP10. OBJ. On the would command line, FP10. OBJ must appear before the LIBC. LIB, LIBCMT. LIB, or MSVCRT. LIB.

Floating - Point Functions provides

The Routine Use
Abs Return the absolute value of the int
A cosine Calculate arccosine
Asin Calculate arcsine
Atan, atan2 Calculate arctangent
Atof Convert a character string to a double - precision floating - point value
Bessel functions provides Calculate Bessel functions provides _j0 _j1, _jn, _y0, _y1, _yn
_cabs Find absolute value of complex number
Ceil Find integer between
_chgsign Reverse the sign of double - precision floating - point argument
_clear87, _clearfp Get and clear floating - point status word
_control87, _controlfp Get old floating - point control word and set new control - word value
_copysign Return one value with the sign of another
Cos Calculate cosine
Cosh Calculate from cosine
Difftime Compute difference between two specified time values
Div Divide one integer by another, returning quotient and remainder
_ecvt Convert a double to a character string of specified length
Exp Calculate an exponential function
Fabs Find absolute value
_fcvt Convert a double to a string with the specified number of who following a decimal point
_finite Determine been given double - precision floating - point value is finite
Floor Find largest integer less than or equal to argument
Fmod Find floating - point remainder
_fpclass Return status word containing information on floating - point class
_fpieee_flt Invoke the user - defined the trap handler for IEEE floating - point exceptions
_fpreset Reinitialize floating - point math package
Frexp Calculate an exponential value
_gcvt Convert floating - point value to a character string
_hypot Calculate hypotenuse of right triangle
_isnan Check given double - precision floating - point value for not a number (NaN)
LABS, the Return value of absolute long
Ldexp Calculate the product of argument and 2 to specified power
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull