import java.util.* ;
import java.lang.* ;
import java.io.* ;
class LogApp
{
public static Float scanFloat
( Scanner in
) {
return ( ( in.hasNextFloat ( ) ) ? in.nextFloat ( ) : null ) ;
}
public static void main
( String [ ] args
) {
// Объявление переменных k,p,s,n типа float для хранения входных данных
float k = 0 ;
float p = 0 ;
float s = 0 ;
float n = 0 ;
Scanner in
= new Scanner
( System .
in ) ;
// Ввод пользователем значений переменных k,p,s,n с помощью scanf
System .
out .
println ( "please enter k:\n " ) ; k = scanFloat( in ) ;
System .
out .
println ( "please enter p:\n " ) ; p = scanFloat( in ) ;
System .
out .
println ( "please enter s:\n " ) ; s = scanFloat( in ) ;
System .
out .
println ( "please enter n:\n " ) ; n = scanFloat( in ) ;
in.close ( ) ;
// Вывод исходных данных
System .
out .
printf ( "------------------------------------\n " ) ; System .
out .
printf ( "k = %f\n " ,k
) ; System .
out .
printf ( "p = %f\n " ,p
) ; System .
out .
printf ( "s = %f\n " ,s
) ; System .
out .
printf ( "n = %f\n " ,n
) ; System .
out .
printf ( "------------------------------------\n " ) ;
// Вычисление и вывод результата по формуле с предварительной проверкой значения p,
// которое не должно равняться 1, так как находиться в формуле под логарифмом.
if ( p == 1 )
{
System .
out .
printf ( "wrong input data: p = 1\n " ) ; }
else
{
int result = 0 ;
if ( k >= p )
{
System .
out .
printf ( "! WARNING !, suspicious input data:output weight less or equal to the initial weight!\n " ) ; }
result
= ( int ) ( Math .
log10 ( ( n
* s
) / k
) / Math .
log10 ( p
) ) ; // приводим к целому числу сезонов.
if ( result < 1 )
{
System .
out .
printf ( "! ERROR ! Growing time is shorter than one season!\n " ) ; }
else
{
System .
out .
printf ( "result is: %d\n " , result
) ; }
}
System .
out .
printf ( "====================================\n " ) ; }
}
aW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgpjbGFzcyBMb2dBcHAKeyAKICAgcHVibGljIHN0YXRpYyBGbG9hdCBzY2FuRmxvYXQoIF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ZiAoIGsgPj0gcCApCiAgICAgIAkgewogICAgICAJIAkgIFN5c3RlbS5vdXQucHJpbnRmKCIhIFdBUk5JTkcgISwgc3VzcGljaW91cyBpbnB1dCBkYXRhOm91dHB1dCB3ZWlnaHQgbGVzcyBvciBlcXVhbCB0byB0aGUgaW5pdGlhbCB3ZWlnaHQhXG4iKTsKICAgICAgCSB9CiAgICAgIAkgICAKICAgICAgICAgIHJlc3VsdCA9IChpbnQpICggTWF0aC5sb2cxMCggKCBuICogcyApIC8gayApIC8gTWF0aC5sb2cxMCggcCApICk7IC8vINC/0YDQuNCy0L7QtNC40Lwg0Log0YbQtdC70L7QvNGDINGH0LjRgdC70YMg0YHQtdC30L7QvdC+0LIuCiAgICAgICAgICAKICAgICAgICAgIGlmICggcmVzdWx0IDwgMSApCiAgICAgICAgICB7CiAgICAgICAgICAgICAgU3lzdGVtLm91dC5wcmludGYoIiEgRVJST1IgISBHcm93aW5nIHRpbWUgaXMgc2hvcnRlciB0aGFuIG9uZSBzZWFzb24hXG4iKTsKICAgICAgICAgIH0KICAgICAgICAgIGVsc2UKICAgICAgICAgIHsKICAgICAgICAgICAgICBTeXN0ZW0ub3V0LnByaW50ZigicmVzdWx0IGlzOiAlZFxuIiwgcmVzdWx0KTsKICAgICAgICAgIH0KICAgICAgfQogICAgICAKICAgICAgU3lzdGVtLm91dC5wcmludGYoIj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PVxuIik7CiAgIH0KfQ==