Skip to main content

Posts

Showing posts from January, 2022

Light OJ -- 1212(Double Ended Queue)

To learn dequeue: In bangla:http://www.shafaetsplanet.com/?p= 2316 Learn function:https://www.cplusplus.com/reference/deque/deque/ ///Bismillahir Rahmanir Rahim ///Author:Tanvir Ahmmad ///CSE,Islamic University,Bangladesh #include< iostream > #include< cstdio > #include< algorithm > #include< string > #include< cstring > #include< sstream > #include< cmath > #include< cstring > #include< vector > #include< queue > #include< map > #include< set > #include< stack > #include< vector > #include< iterator > #include   < functional >   ///sort(arr,arr+n,greater<int>()) for decrement of array /*every external angle sum=360 degree   angle find using polygon hand(n) ((n-2)*180)/n*/ ///Floor[Log(b)  N] + 1 = the number of digits...

Light OJ -- 1113(Discover the Web)

To learn stack(In Bangla) http://www.shafaetsplanet.com/?p=2342 In english:https://www.geeksforgeeks.org/stack-in-cpp-stl/ Learn function:https://www.cplusplus.com/reference/stack/stack/ ///Bismillahir Rahmanir Rahim ///Author:Tanvir Ahmmad ///CSE,Islamic University,Bangladesh #include<iostream> #include<cstdio> #include<algorithm> #include<string> #include<cstring> #include<sstream> #include<cmath> #include<cstring> #include<vector> #include<queue> #include<map> #include<set> #include<stack> #include<vector> #include<iterator> #include <functional> ///sort(arr,arr+n,greater<int>()) for decrement of array /*every external angle sum=360 degree   angle find using polygon hand(n) ((n-2)*180)/n*/ ///Floor[Log(b)  N] + 1 = the nu...

Light OJ -- 1022(trailing_zeroes_i)

  in   this  problem given radious of a circle So,Circle area=pi*r*r So,Square area=4*r*r Shadow area=Sqare area-Circle area N.B:Plesae print after 2 decimal print(Use C for this) ///Bismillahir Rahmanir Rahim ///Author:Tanvir Ahmmad ///CSE,Islamic University,Bangladesh #include<iostream> #include<cstdio> #include<algorithm> #include<string> #include<cstring> #include<sstream> #include<cmath> #include<cstring> #include<vector> #include<queue> #include<map> #include<set> #include<stack> #include<vector> #include<iterator> #include <functional> ///sort(arr,arr+n,greater<int>()) for decrement of array /*every external angle sum=360 degree   angle find using polygon hand(n) ((n-2)*180...

fixed point iteration method using C++

F(x)=X2- 6 X+ 8 G(X)=X=(X2+8)/6; We have to initiate a value then put it on G(X) and get value of G(X) and then put this on F(X).it continues until it F(X)=0 or we get tolerable fraction into F(X) to output or finishing maximum iteration step.  ///Bismillahir Rahmanir Rahim ///Author: Tanvir Ahmmad ///CSE,Islamic University,Bangladesh #include<iostream> #include<math.h> using namespace std; double func(double num) {     return ((num*num)-(6*num)+8); } double value(double num) {     return ((8+(num*num))/6); } int main() {     double guess,tol,val,fund,ans;     int it_time,i;     cout<<"Enter...

Light OJ -- 1449(Redirect_URL)

Check weather it is http or https. if it is http then convert it to https.  ///Bismillahir Rahmanir Rahim ///Author: Tanvir Ahmmad ///CSE,Islamic University,Bangladesh #include<iostream> #include<cstdio> #include<algorithm> #include<string> #include<cstring> #include<sstream> #include<cmath> #include<cstring> #include<vector> #include<queue> #include<map> #include<set> #include<stack> #include<vector> #include<iterator> #include <functional> ///sort(arr,arr+n,greater<int>()) for decrement of array /*every external angle sum=360 degree   angle find using polygon hand(n) ((n-2)*180)/n*/ ///Floor[Log(b)  N] + 1 = the number of digits when any number...

Regula Falsi or False Position Method Using C++

f(x)= X 3 -2X-5 f(2) = -1 f(3) = 16 x=(af(b) - bf(a))/((f(b)-f(a)); ///Bismillahir Rahmanir Rahim ///Author: Tanvir Ahmmad ///CSE, Islamic University, Bangladesh #include<iostream> using namespace std; typedef long long ll; double func(double num) {     return ((3*num*num)-(6*num)+2); } int main() {     char ch=253;     double a,b,out,tol;     cout<<"Given equation : f(x) = 3X"<<ch<<"-6X+2"<<endl;     cout<<"Given two input of x such that f(x) is negative and positive and there difference is just one"<<endl;     while(1)     {         cin>>a>>b;         if(a==1 && b==2)         {             cout<<"Given correct output"<<endl;             break;         }         else      ...

Light OJ -- 1028(circle_in_square)

Think about the prime factor of an number; 9=3,9 10=2,5,10 So, if number is 9 is eligible for 3,9 9 is base 2=1001 9 is base 3=100 9 is base 4=21 9 is base 5=14 9 is base 6=13 9 is base 7=12 9 is base 8=11 9 is base 9=10 continued.... But not gain any zero at last position 9 is base 10=9 ///Bismillahir Rahmanir Rahim ///Author:Tanvir Ahmmad ///CSE,Islamic University,Bangladesh #include< iostream > #include< cstdio > #include< algorithm > #include< string > #include< cstring > #include< sstream > #include< cmath > #include< cstring > #include< vector > #include< queue > #include< map > #include< set > #include< stack > #include< vector > #include< iterator > #include   < functional >   ///sort(arr,arr+n,greater<int>()) for decrement of array /*every external angle sum=360 degree   angle find using...

Light OJ -- 1136(Division_by_3)

  Pattern Look like: 1 = not divisible by 3 12 = divisible by 3 123 = divisible by 3 1234 = not divisible by 3 12345 = divisible by 3 123456 = divisible by 3 1234567 = not divisible by 3 12345678 = divisible by 3 123456789 = divisible by 3 12345678910 = not divisible by 3 Look like pattern: No, Yes, Yes, No, Yes, Yes, No, Yes, Yes... ///Bismillahir Rahmanir Rahim ///Author: Tanvir Ahmmad ///CSE, Islamic University,Bangladesh #include<iostream> #include<iostream> #include<cstdio> #include<algorithm> #include<string> #include<cstring> #include<sstream> #include<cmath> #include<cstring> #include<vector> #include<queue...

Light OJ -- 1053(Higher_math)

                Check weather it is right angle or not. Using the  Pythagoras' theorem. ///Bismillahir Rahmanir Rahim ///Author: Tanvir Ahmmad ///CSE,Islamic University,Bangladesh #include<iostream> #include<cstdio> #include<algorithm> #include<string> #include<cstring> #include<sstream> #include<cmath> #include<bitset> #include<cstring> #include<vector> #include<queue> #include<map> #include<set> #include<stack> #include<vector> #include<iterator> #include <functional> ///sort(arr,arr+n,greater<int>()) for decrement of array /*every external angle sum=360 degree   angle find using polygon hand(n) ((n-2)*180)/n*/ ///Floor[Log(b)  N] + 1 = the number of digits when any n...

Light OJ -- 1007(mathematically-hard)

Think about Euler's totient function: Euler's totient function, also known as phi-function ϕ(n),  counts the number of integers between 1 and n inclusive , which are coprime to n. Two numbers are coprime if their greatest common divisor equals 1 (1 is considered to be coprime to any number). ///Bismillahir Rahmanir Rahim ///Author: Tanvir Ahmmad ///CSE, Islamic University,Bangladesh  #include<iostream> #include<iostream> #include<cstdio> #include<algorithm> #include<string> #include<cstring> #include<sstream> #include<cmath> #include<cstring> #include<vector> #include<queue> #include<map> #include<set> #include<stack> #include<vector> #include<iterator> #include <functional> ///sort(arr,arr+n,greater<int>()) for decrement of array /*every external angle sum=360 degree   angle find using polygon hand(n) ((n-2)*180)/n*/ ///Floor[Log(b)  N] + 1 = the number o...