[Practice](rcb_vs_csk [] (CodeChef: Practical coding for everyone))
Author: Aryan KD
Tester: Aryan KD
Editorialist: Aryan KD
DIFFICULTY:
CAKEWALK, SIMPLE, EASY.
PREREQUISITES:
Math .
PROBLEM:
Everyone knows INDIA is best in cricket. INDIA always finishesh every international match at top every year.
INDIA every year holds worlds biggest league match that is IPL ( cricket match league) . Like every year this year also IPL is going on . today’s match is between RCB vs CSK . this is going to be very interesting match .
RCB won the toss and decided to bat . now worlds most destructive duos on the crease , that is Abd and Virat . Today Abd is in different mood he is hitting all the ball outside the boundry , he is not giving strike to his partner Virat to play any ball .
How many maximum runs will Abd scores ? if he play all the ball . atleast 1 ball Abd will play .
RULE :
There is not any extra run that is No ball, freehit , wideball, overthrow , legby . They will run at most 3 run in 1 ball. One over consist of 6 balls , after every one over strike changes ( if Virat is on strike then next overs first ball Abd will play ) .
QUICK EXPLANATION:
you have given N number of ball played by abd and you have to just find out how many maximum run he will score .
EXPLANATION:
in given problm you have given N that is number of balls played by Abd you have just find out the how many max run he will score ? if he will play 6 ball then he will hit 6 sixes on six ball that is 36 run in similar way if he will play a 7 ball then he will hit 6 sixes on 6 balls and 3 run in remaining 1 ball thatis total 39 run .
SOLUTIONS:
Setter's Solution

//rcb vs csk

#include<bits/stdc++.h>

using namespace std;

void testcase()

{

int n;

cin>>n;

if(n%6==0){

cout<<((((n/6)1)*3)+((n((n/6)1))*6));

}

else {

cout<<(((n/6)*3)+((n(n/6))*6));

}
 }

int main()

{

int t;

cin>>t;

while(t–)

{

testcase();

cout<<endl;

}

return 0;
Tester's Solution

//rcb vs csk

#include<bits/stdc++.h>

using namespace std;

void testcase()

{

int n;

cin>>n;

if(n%6==0){

cout<<((((n/6)1)*3)+((n((n/6)1))*6));

}

else {

cout<<(((n/6)*3)+((n(n/6))*6));

}
 }

int main()

{

int t;

cin>>t;

while(t–)

{

testcase();

cout<<endl;

}

return 0;
Editorialist's Solution

//rcb vs csk

#include<bits/stdc++.h>

using namespace std;

void testcase()

{

int n;

cin>>n;

if(n%6==0){

cout<<((((n/6)1)*3)+((n((n/6)1))*6));

}

else {

cout<<(((n/6)*3)+((n(n/6))*6));

}
 }

int main()

{

int t;

cin>>t;

while(t–)

{

testcase();

cout<<endl;

}

return 0;