CHESSTIME-Editorial

PROBLEM LINK:

Contest
Practice

Setter: Lavish Gupta
Tester: Abhinav Sharma, Manan Grover
Editorialist: Kiran

DIFFICULTY:

337

PREREQUISITES:

None

PROBLEM:

Chef has recently started playing chess, and wants to play as many games as possible. Chef takes at least 20 minutes to play one game. Our objective is to find what is the maximum number of complete chess games he can play if he has got N hours of free time.

EXPLANATION:

  • Here we take an input to variable N representing the available free time in Hours.

  • Given that the Chef takes at least 20 minutes to finish a game, we need to calculate the available free time in minutes.

  • Comparing the available free time with the time taken for a single game, we get the maximum number of games chef can play.

  • Solution:

    1. N hours = N*60 minutes of free time

    2. Maximum number of games chef can play = (N*60)/20

TIME COMPLEXITY:

O(1)

SOLUTION:

Editorialist's Solution
	int t;
	cin>>t;
	for(int i=0;i<t;i++)
	{
	    int n;
	    cin>>n;
	    cout<<(n*60)/20<<"\n";
	}