Skip to main content

Posts

Showing posts from February, 2022

Light OJ -- 1082(Array Queries)

  criteria to solve the problem:segment tree In bangla:http://www.shafaetsplanet.com/?p= 1557 In english:https://cp-algorithms.com/data_structures/segment_tree.html tree node=( 2 *n)+ 1 ; ///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[L...

educational codeforces round 59(B. Digital root)

  Problem solving technique:Patten 1 = 1    10 = 1 + 0 = 1     19 = 1 + 9 = 10 = 1 + 0 = 1 2 = 2    11 = 1 + 1 = 2     20 = 2 + 0 = 2 3 = 3    12 = 1 + 2 = 3     21 = 2 + 1 = 3 4 = 4    13 = 1 + 3 = 4     22 = 2 + 2 = 4 5 = 5    14 = 1 + 4 = 5     23 = 2 + 3 = 5 6 = 6    15 = 1 + 5 = 6     24 = 2 + 4 = 6 7 = 7    16 = 1 + 6 = 7     25 = 2 + 5 = 7 8 = 8    17 = 1 + 7 = 8     26 = 2 + 6 = 8 9 = 9    18 = 1 + 8 = 9     27 = 2 + 7 = 9 After  9 th interval we got same digital root ///Bismillahir Rahmanir Rahim ///Author: Tanvir Ahmmad ///CSE,Islamic University,Bangladesh #include< iostream > #include< cstdio > #include< algorithm > #include< string > #include< cstring ...

educational codeforces round 56(B. Letters Rearranging)

  Problem solving criteria:Just check palindrome or not Palindrome:a word, phrase, or sequence that reads the same backwards as forwards. checking palindrome:revserse a string then checking it is equal to the previous string. rev=str; reverse(rev.begin(),rev.end()); if (rev==str) print(palindrome) ///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(ar...

AtCoder Beginner Contest 237(D - LR insertion)

Problem solving criteria:stack (https://www.cplusplus.com/reference/stack/stack/) Think about the first input: LRRLR That means  0 ->(L)-> 1 ->(R)-> 2 ->(R)-> 3 ->(L)-> 4 ->(R)-> 5 so we just need to save first R right number  in  an  array (vector) & other number saves  in  a stack. 0 ->(L)-> 1   general  array (vector)       stack( 0 )   top of stack= 0 1 ->(R)-> 2   general  array (vector)= 1      stack( 0 )   top of stack= 0 2 ->(R)-> 3   general  array (vector)= 1 , 2    stack( 0 )   top of stack= 0 3 ->(L)-> 4   general  array (vector)= 1 , 2    stack( 0 , 4 )...

AtCoder Beginner Contest 237(C - kasaka)

  To learn string: function:https://www.cplusplus.com/reference/string/string/ palindrome:A palindrome is a word, number, phrase, or other sequence of characters which reads the same backward as forward. abba--palindrome mosque--not palindrome At first need to check how many  'a'  from the beginning and from the last then minus it and lastly check it is palindrome or not. 1 .kasaka (first  'a' = 0  & last  'a' = 1 ) after erase last  1 ( 1 - 0 )  'a'  kasak & check kasak is palindrome or not(palindrome) 2 .atcoder (first  'a' = 1  & last  'a' = 0 ) after erase last  0 (first>last)  'a'  atcoder...