Wednesday, 1 Dec 2021
Category: Maths

Given an integer X, D and T, the task is to check if it is possible to reduce X to 0 in exactly T moves. In each move, X can be reduced by either D or 1. Print YES if possible, else NO.Example:Input: X = 10, D = 3, T = 6Output: YESExplanation: Below are […]

Convert A into B by incrementing or decrementing 1, 2, or 5 any number of timesGiven two integers A and B, the task is to find the minimum number of moves needed to make A equal to B by incrementing or decrementing the A by either 1, 2, or 5 any number of times.Examples:Input: A […]

#include using namespace std;  void check_position(int a, int b, int c, int d,                    int x1, int y1, int z1,                    int x2, int y2, int z2){        int value_1 = a * x1 + b * y1 + c * z1 + d;    int value_2 = a * x2 + b * y2 + c * z2 + d;          if ((value_1 > 0 […]

#include using namespace std;  double line_slope(double a, double b){    if (a != 0)        return -b / a;                  else        return (-2);}  void line_equation(double a, double b,                   double c, double x1,                   double y1, double alfa){        cout