# Akash and Missing Class Solution Codechef

## Akash and Missing Class Solution Codechef

Akash loves going to school, but not on weekends. A week consists of 7 days (Monday to Sunday). Akash takes a leave every Saturday. If a month consists of N days and the first-day of the month is Monday, find the number of days Akash would take a leave in the whole month.

Input Format

• First line will contain T, the number of test cases. Then the test cases follow.
• Each test case contains a single line of input, one integer N – the number of days in the month.

Output Format

For each test case, output in a single line, the number of days Akash would take a leave in the whole month.

Constraints

• 1≤T≤100
• 1≤N≤10^9

• Subtask 1 (30 points) : 1≤N≤100
• Subtask 2 (70 points) : Original Constraints

Sample Input 1

``````4
5
6
8
22``````

Sample Output 1

``````0
1
1
3``````

Explanation

• Test case 1: The month consists of 5 days (Monday, Tuesday, Wednesday, Thursday, and Friday). Since there are no Saturdays, Akash would go to school every day. Thus, he takes a leave for 0 days.
• Test case 2: The month consists of 6 days (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday). Akash takes a leave only on Saturday. Thus, he takes a leave for 1 day.
• Test case 3: The month consists of 8 days (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday, Monday). Akash takes a leave only on Saturday. Thus, he takes a leave for 1 day.

### SOLUTION

Program: Akash and Missing Class Solution Codechef in C++

``````#include <iostream>
#define ll long long
using namespace std;
int main()
{
ll t;
cin>>t;
while(t--)
{
ll n;
cin>>n;
ll ans = n/7;
ll x = n%7;
if(x==6)
{
cout<<ans+1<<endl;
}
else
{
cout<<ans<<endl;
}
}
return 0;
}``````

Program: Akash and Missing Class Solution Codechef in Python

``````for _ in range(int(input())):
n=int(input())
a=n//7
b=n%7
if b==6:
print(a+1)
else:
print(a)``````