Posts

Travel Pass | Codechef September long challenge 2021 | Travel Pass Solution

Image
  C odechef September long challenge 2021 | Travel Pass Solution                                     Scorable Problems for Division 3   Name   Code   Successful Submissions   Accuracy Airline Restrictions AIRLINE Travel Pass TRAVELPS Shuffling Parities SHUFFLIN XOR Equal PALINT Minimize Digit Sum MNDIGSUM 2-D Point Meeting POINTMEE Covaxin vs Covishield COVAXIN Treasure Hunt TREHUNT Minimum Digit Sum 2 MNDIGSM2 2 Problem.  Travel Pass  Problem Code:  TRAVELPS Submit Read problem statements in  Bengali ,  Mandarin Chinese ,  Russian , and  Vietnamese  as well. Chef is going on a road trip and needs to apply for inter-district and inter-state travel e-passes. It takes  A A  minutes to fill each inter-district e-pass application and  B B  minutes for each inter-state e-pass application. His journey is given to you as a binary string  S S  of length  N N  where  0 0  denotes crossing from one district to another district (whic

Minimize Digit Sum Solution | Codechef September long challenge 2021

Image
                  September Challenge 2021 (Rated for Div 3)                                     Scorable Problems for Division 3   Name   Code   Successful Submissions   Accuracy Airline Restrictions AIRLINE Travel Pass TRAVELPS Shuffling Parities SHUFFLIN XOR Equal PALINT Minimize Digit Sum MNDIGSUM 2-D Point Meeting POINTMEE Covaxin vs Covishield COVAXIN Treasure Hunt TREHUNT Minimum Digit Sum 2 MNDIGSM2 Codechef September long challenge 2021 | Minimize Digit Sum Solution Post published: September 4, 2021 Post category: Coding Post comments: 0 Comments Let  f ( n , B ) f(n,B)  be the sum of digits of the integer  n n  when written in base  B B . Given  Q Q  queries, each consisting of three integers  n , l n,l  and  r r . Find the value of  B B  corresponding to which  f ( n , B ) f(n,B)  is minimum for all  l ≤ B ≤ r l≤B≤r . If there are multiple such values, you can print any of them. Input Format The first line contains in single integer  Q Q , the number of queries Each of the n