Category : equation

I need to evaluate the expression cbrt(b) / ((b)^2 + 1). If b less than zero, the log is not correct and outputs an incorrect answer. For example, if the input is -3 the answer is y = -1IND. #include <iostream> #include <cmath> int main() { float b, y, y1, y2; std::cout << "The equation: ..

Read more

int Electra2D::Collision() { for (std::list<Entity>::iterator affecting = entities.begin(); affecting != entities.end(); ++affecting) { for (std::list<Entity>::iterator affected = entities.begin(); affected != entities.end(); ++affected) { if (affecting->type == DrawTypes::Circle && affected->type == DrawTypes::Circle && affecting->object->id != affected->object->id) { float distance = affected->pos.getDistance(affecting->pos); float limit = ((ObjectCircle*)affected->object)->radius + ((ObjectCircle*)affecting->object)->radius; if (distance <= limit) { Vector2 SP = affected->velocity ..

Read more

Original problem. Given two valid fractions a/b and c/d. Each transformation is adding 1 to a and b, then optimizing a/b. Find the number of steps transforming a/b into c/d so that 0<a<b<100000 and 0<c<d<100000, or none if there is no ways. #include <iostream> #include <math.h> using namespace std; int gcd(int x, int y) { ..

Read more