Subscriptions CodeChef Solution

Problem – Subscriptions CodeChef Solution

A new TV streaming service was recently started in Chefland called the Chef-TV.

A group of NN friends in Chefland want to buy Chef-TV subscriptions. We know that 66 people can share one Chef-TV subscription. Also, the cost of one Chef-TV subscription is XX rupees. Determine the minimum total cost that the group of NN friends will incur so that everyone in the group is able to use Chef-TV.

Input Format

  • The first line contains a single integer TT — the number of test cases. Then the test cases follow.
  • The first and only line of each test case contains two integers NN and XX — the size of the group of friends and the cost of one subscription.

Output Format

For each test case, output the minimum total cost that the group will incur so that everyone in the group is able to use Chef-TV.

Constraints

  • 1≤T≤1000
  • 1≤N≤100
  • 1≤X≤1000

Sample 1:

Input: 3
1 100
12 250
16 135
Output: 100
500
405

Explanation:

  • Test case 1: There is only one person in the group. Therefore he will have to buy 11 subscription. Therefore the total cost incurred is 100100.
  • Test case 2: There are 1212 people in the group. Therefore they will have to buy 22 subscriptions. Therefore the total cost incurred is 500500.
  • Test case 3: There are 1616 people in the group. Therefore they will have to buy 33 subscriptions. Therefore the total cost incurred is 405405

Subscriptions CodeChef Solution in Java

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int t = Integer.parseInt(br.readLine());
		while (t-- > 0) {
		  StringTokenizer st = new StringTokenizer(br.readLine());
		  int n = Integer.parseInt(st.nextToken());
		  int x = Integer.parseInt(st.nextToken());
		  
		  System.out.println((int)(Math.ceil(n / 6.0) * x));
		}
	}
}

Subscriptions CodeChef Solution in Pyth 3

# cook your dish here
import math as m
for i in range(int(input())):
    a,b=map(int,input().split())
    print(m.ceil(a/6)*b)

Subscriptions CodeChef Solution in C++17

#include <iostream>
using namespace std;

int main() {
	int t;
	cin>>t;
	while(t--){
	    int n, x;
	    cin>>n>>x;
	    cout<<((n/6) + (n%6?1:0))*x<<endl;
	}
	return 0;
}
Subscriptions CodeChef Solution Review:

In our experience, we suggest you solve this Subscriptions 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 Subscriptions CodeChef Solution

Find on CodeChef

Conclusion:

I hope this Subscriptions 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 *