Math Formulas to Over kill Problems


Wed Aug 17 2022 20:33:33 GMT+0000 (Coordinated Universal Time)

Saved by @Aly #c++ #math

//Sum of numbers from 1 ---> n
int n, sum;
sum = (n*(n+1))/2;
//flooring integer number (int)        "floor أرضيه"
int a=5, b=2;
int n = a/b; // n= 2
//Ceiling integer number (int)          "ceil سقف"
int a=5, b=2;
int ans = (a+(b-1))/b; //n=3
//Division Theory 
int a=10, b=3;     // a ---> numerator البسط / b ---> denominator المقام
int ans = a/b;     // n= 3
//1- you can give everyone of b ans
//2- ans is a number of numbers from 1--> a which is divisible by b (find multiple in Range)
//Number of Steps