Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
There are N bikes and M cars on the road.
Find the total number of tyres on the road.
For each test case, output in a single line, the total number of tyres on the road.
Input: 2
2 1
3 0
Output: 8
6
Test Case 1: There are 2 bikes and 1 car. Each bike has 2 tyres, so there are 2⋅2=4 bike tyres. Similarly, each car has 4 tyres, so there are 1⋅4=4 car tyres. Adding the tyres of all vehicles, we get 4+4=8 tyres in total.
Test Case 2: There are 3 bikes and 0 cars. Each bike has 2 tyres, so there are 3⋅2=6 bike tyres. There are no cars, so there are 0⋅4=0 car tyres. Adding the tyres of all vehicles, we get 6+0=6 tyres in total.
#include<bits/stdc++.h>
using namespace std;
#define int long long int
int32_t main()
{
int t;
cin>>t;
while(t--)
{
int x,y;
cin>>x>>y;
cout<<2*x+4*y<<endl;
}
}
import java.util.*;
import java.lang.*;
import java.io.*;
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
for(int i = 0;i<T;i++){
int N = sc.nextInt();
int M = sc.nextInt();
System.out.println(N*2+M*4);
}
}
}
n=int(input())
for i in range(n):
a,b=list(map(int,input().split()))
print(a*2+b*4)
In our experience, we suggest you solve this Tyre problem CodeChef Solution and gain some new skills from Professionals completely free and we assure you will be worth it.
If you are stuck anywhere between any coding problem, just visit Queslers to get the Tyre problem CodeChef Solution
I hope this Tyre problem CodeChef Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Coding Solutions.
This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.
Keep Learning!
More Coding Solutions >>