- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
#include <iostream>
#include <math.h>
using namespace std;
double absolute( double x ) {
return (( x >= 0.0 ) ? x : x*(-1) );
}
double get_cof( double time ) {
if( time ==1 ) return 1;
double rettime = ( time + 1 ) / time;
return rettime;
}
double get_disnow( double time, double speed ) {
double disnow = get_cof( time ) * speed;
return disnow;
}
double get_distance( double time, double speed ) {
if( time ==1 ) return 20;
double distance = get_disnow( time, speed );
return distance;
}
using namespace std;
int main( int argc, char **argv ) {
double x = 0.0;
for( double t = 1.0; t < 10000 ;t+=1 )
{
x += get_distance( t, 10.0 );
x *= get_cof( t );
if( (absolute( x - (t * 100 ) ) < 5) || t == 6480 )
{
cout << " hallelua time = " << t << endl;
cout << " Moskitos = " << x << " cm; ";
cout << ", Man = " << t * 100 << " cm; " << endl;
}
}
return 0;
}
Даже не знаю, что здесь самое интересное. Просто прочитайте.