PCL FEB 22 - Munshi & YT - Editorial

EDITORIAL

PROBLEM NAME : Munshi & YT

DIFFICULTY : Simple

PREREQUISITES : None

PROBLEM : Munshi is a newcomer to the world of YouTube. He was fortunate enough to get a sponsor. In between his content, his sponsor provides him with an
X-minute advertisement to play. Munshi’s material is N minutes long. He decides on a
4:1 content-to-advertising ratio since he does not want his viewers to be bothered by the adverts. He must determine how many advertisements he can include in his final video based on this criteria. He wants your help counting the adverts he can fit in his video because he is busy streaming video games.
Note: If the answer is not an integer, you must round off the answer to the closest smaller integer.
TASK : Determine the maximum number of advertisements he can add while maintaining the 4:1 ratio.

CONSTRAINTS :
1≤T≤1000
1≤N,X≤ 10^{18}

SAMPLE INPUT (1) :
1
8 1

SAMPLE OUTPUT (1) :
2

EXPLANATION :
Calculate Munshi’s total ad-time by dividing the total time of Munshi’s content(N) in a 4:1 ratio. Basically dividing N by 4.
Divide the calculated ad-time by the value of X to find the final answer.

SOLUTION:

#include <bits/stdc++.h>
using namespace std;
int main(){
    int T;
    cin >> T;
while(T--){
            long long int N,X;
            cin>>N>>X;
long long int ad_time = N/4;
            cout<<ad_time/X<<"\n";
    }
}

OPTIMAL COMPLEXITY :
Time - O(1)
Space - O(1)