Chess Time CodeChef Solution

Problem – Chess Time CodeChef Solution

Chef has recently started playing chess, and wants to play as many games as possible.

He calculated that playing one game of chess takes at least 20 minutes of his time.

Chef has N hours of free time. What is the maximum number of complete chess games he can play in that time?

Input Format

  • The first line of input will contain a single integer T, denoting the number of test cases.
  • Each test case consists of a single line containing a single integer, N.

Output Format

For each test case, output on a new line the maximum number of complete chess games Chef can play in N hours.

Constraints

  • 1 \leq T \leq 101≤T≤10
  • 1 \leq N \leq 101≤N≤10

Sample 1:

Input: 4
1
10
7
3
Output: 3
30
21
9

Explanation:

Test case 1: If every game Chef plays takes 20 minutes, he can play 3 games in one hour.

Test case 2: If every game Chef plays takes 20 minutes, he can play 30 games in 10 hours.

Test case 3: If every game Chef plays takes 20 minutes, he can play 21 games in 7 hours.

Test case 4: If every game Chef plays takes 20 minutes, he can play 9 games in 3 hours.

Chess Time CodeChef Solution in C++17

#include <iostream>
using namespace std;

int main() {
	int n,tc;
	cin>>tc;
	for(int i=0;i<tc;i++){
	    cin>>n;
	    cout<<n*3<<endl;
	}
	return 0;
}

Chess Time 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();
	    while (t-->0){
	        int k = sc.nextInt();
	        System.out.println((k*60)/20);
	    } 
	}
}

Chess Time CodeChef Solution in Python3

T=int(input())
for i in range(T):
    N=int(input())
    print((N*60)//20)
Chess Time CodeChef Solution Review:

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

Find on CodeChef

Conclusion:

I hope this Chess Time 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.