Tyre problem CodeChef Solution

Problem – Tyre problem CodeChef Solution

There are N bikes and M cars on the road.

  • Each bike has 2 tyres.
  • Each car has 4 tyres.

Find the total number of tyres on the road.

Input Format

  • The first line will contain T – the number of test cases. Then the test cases follow.
  • The first and only line of each test case contains two integers N,M.

Output Format

For each test case, output in a single line, the total number of tyres on the road.

Constraints

  • 1≤T≤1000
  • 0≤N,M≤100

Sample 1:

Input: 2
2 1
3 0
Output: 8
6

Explanation:

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.

Tyre problem CodeChef Solution in C++17

#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;
    }
}

Tyre problem CodeChef Solution in Java

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);
		
	
		
		}
	}
}

Tyre problem CodeChef Solution in Pyth 3

n=int(input())
for i in range(n):
    a,b=list(map(int,input().split()))
    print(a*2+b*4)
Tyre problem CodeChef Solution Review:

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

Find on CodeChef

Conclusion:

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 >>

LeetCode Solutions

Hacker Rank Solutions

CodeChef Solutions

Leave a Reply

Your email address will not be published. Required fields are marked *